GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: agents ask the user for a secret through a private card (#15907) · pingdotgg/t3code@9f61ba6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps
    • mobile/src
      • features/threads
        • SecretRequestCard.tsx
        • ThreadFeed.tsx
      • lib
        • threadActivity.ts
    • server/src
      • auth
        • RpcAuthorization.ts
      • mcp
        • OrchestratorMcpService.activity.test.ts
        • OrchestratorMcpService.test.ts
        • OrchestratorMcpService.ts
        • OrchestratorMcpToolkit.integration.test.ts
        • toolkits
          • core.test.ts
          • orchestrator
            • handlers.ts
            • tools.ts
          • worktree
            • registration.test.ts
      • observability
        • Metrics.ts
      • orchestration-v2
        • ClaudeAutomaticDelivery.integration.test.ts
        • Orchestrator.ts
        • ProjectionSettlement.test.ts
        • ProjectionStore.ts
        • ProviderRuntimeRecoveryService.test.ts
        • ProviderRuntimeRecoveryService.ts
        • ThreadLaunchService.test.ts
        • runtimeLayer.ts
      • provider
        • T3OrchestrationInstructions.ts
      • scheduledTasks
        • ScheduledTaskService.schedule.test.ts
        • ScheduledTaskService.test.ts
        • ScheduledTaskService.ts
        • ScheduledTaskService.webhook.test.ts
      • scheduling
        • Scheduler.integration.test.ts
      • secrets
        • SecretRequests.test.ts
        • SecretRequests.ts
      • ws.ts
    • web/src
      • components
        • ChatView.tsx
        • chat
          • MessagesTimeline.tsx
          • SecretRequestCard.tsx
      • session-logic.ts
  • docs/operations
    • observability.md
  • packages
    • client-runtime
      • package.json
      • src
        • secretRequest.test.ts
        • secretRequest.ts
        • state
          • server.ts
        • t3ToolSummary.ts
    • contracts/src
      • baseSchemas.ts
      • index.ts
      • orchestrationV2.test.ts
      • orchestrationV2.ts
      • orchestratorMcp.ts
      • rpc.ts
      • scheduledTask.ts
      • secretRequest.ts
    • shared/src
      • t3McpToolPresentation.ts

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/mobile/src/features/threads/SecretRequestCard.tsx‎

Copy file name to clipboard
+170Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
import {
2+
SECRET_REQUEST_DEFAULT_PLACEHOLDER,
3+
SECRET_REQUEST_PRIVACY_NOTE,
4+
secretRequestAnswerInput,
5+
secretRequestDisplay,
6+
secretRequestFailureMessage,
7+
type SecretRequestItem,
8+
} from "@t3tools/client-runtime/secret-request";
9+
import {
10+
isAtomCommandInterrupted,
11+
squashAtomCommandFailure,
12+
} from "@t3tools/client-runtime/state/runtime";
13+
import type { EnvironmentId, OrchestrationV2ProjectedTurnItem } from "@t3tools/contracts";
14+
import { useRef, useState } from "react";
15+
import { Pressable, View, type ColorValue } from "react-native";
16+
17+
import { SymbolView, type AppSymbolName } from "../../components/AppSymbol";
18+
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
19+
import { serverEnvironment } from "../../state/server";
20+
import { useAtomCommand } from "../../state/use-atom-command";
21+
import { RequestActionButton } from "./RequestActionButton";
22+
23+
/**
24+
* Feed card for a secret an agent asked the user for. The typed value lives
25+
* only in this component's state and the RPC payload: it is never logged,
26+
* alerted, or persisted, and the field clears once the answer is sent.
27+
*/
28+
const LOCK_SYMBOL: AppSymbolName = { ios: "lock", android: "lock" };
29+
const PRIVATE_SYMBOL: AppSymbolName = { ios: "checkmark.shield", android: "lock" };
30+
31+
export function SecretRequestCard(props: {
32+
readonly environmentId: EnvironmentId;
33+
readonly projectedItem: OrchestrationV2ProjectedTurnItem;
34+
readonly iconColor: ColorValue;
35+
}) {
36+
const { item, visibility } = props.projectedItem;
37+
if (item.type !== "secret_request") return null;
38+
const display = secretRequestDisplay(item, visibility);
39+
if (display.kind === "pending") {
40+
return (
41+
<PendingSecretRequestForm
42+
environmentId={props.environmentId}
43+
item={item}
44+
iconColor={props.iconColor}
45+
/>
46+
);
47+
}
48+
const icon: AppSymbolName =
49+
display.kind === "pending-elsewhere"
50+
? LOCK_SYMBOL
51+
: display.outcome === "saved"
52+
? "checkmark"
53+
: "minus";
54+
return (
55+
<View className="mb-3 min-h-9 flex-row items-center gap-2 px-1">
56+
<SymbolView name={icon} size={13} tintColor={props.iconColor} type="monochrome" />
57+
<Text className="flex-1 font-sans text-sm text-foreground-muted" numberOfLines={2}>
58+
{item.label} · {display.label}
59+
</Text>
60+
</View>
61+
);
62+
}
63+
64+
function PendingSecretRequestForm(props: {
65+
readonly environmentId: EnvironmentId;
66+
readonly item: SecretRequestItem;
67+
readonly iconColor: ColorValue;
68+
}) {
69+
const { item } = props;
70+
const answer = useAtomCommand(serverEnvironment.answerSecretRequest, {
71+
label: "answer secret request",
72+
// The failure cause holds the request; keep it out of the console.
73+
reportFailure: false,
74+
reportDefect: false,
75+
});
76+
const [secret, setSecret] = useState("");
77+
const [submitting, setSubmitting] = useState(false);
78+
const [error, setError] = useState<string | null>(null);
79+
// Submit then a tap can both run before a re-render; this guard is synchronous.
80+
const inFlight = useRef(false);
81+
82+
const send = async (
83+
reply: { readonly type: "save"; readonly secret: string } | { readonly type: "decline" },
84+
) => {
85+
const input = secretRequestAnswerInput(item, reply);
86+
if (input === null || inFlight.current) return;
87+
inFlight.current = true;
88+
setSubmitting(true);
89+
setError(null);
90+
const result = await answer({ environmentId: props.environmentId, input }).finally(() => {
91+
inFlight.current = false;
92+
setSubmitting(false);
93+
});
94+
if (result._tag === "Success") {
95+
// The card switches to its answered row once the item updates.
96+
setSecret("");
97+
return;
98+
}
99+
if (!isAtomCommandInterrupted(result)) {
100+
setError(secretRequestFailureMessage(squashAtomCommandFailure(result)));
101+
}
102+
};
103+
104+
// Same hierarchy as web: what is asked, why, the field, then the promise
105+
// about where the value goes.
106+
return (
107+
<View className="mb-3 gap-3 rounded-[20px] border border-border bg-card-alt p-4">
108+
<View className="gap-1">
109+
<Text className="font-t3-bold text-base text-foreground">{item.label}</Text>
110+
{item.reason.trim() ? (
111+
<Text className="font-sans text-sm leading-5 text-foreground-muted">{item.reason}</Text>
112+
) : null}
113+
</View>
114+
<TextInput
115+
accessibilityLabel={item.label}
116+
placeholder={item.placeholder ?? SECRET_REQUEST_DEFAULT_PLACEHOLDER}
117+
value={secret}
118+
onChangeText={setSecret}
119+
editable={!submitting}
120+
secureTextEntry
121+
autoCorrect={false}
122+
autoCapitalize="none"
123+
autoComplete="off"
124+
textContentType="none"
125+
importantForAutofill="no"
126+
spellCheck={false}
127+
returnKeyType="done"
128+
onSubmitEditing={() => void send({ type: "save", secret })}
129+
/>
130+
{error !== null ? (
131+
<Text
132+
accessibilityRole="alert"
133+
accessibilityLiveRegion="polite"
134+
className="font-sans text-sm text-danger-foreground"
135+
>
136+
{error}
137+
</Text>
138+
) : null}
139+
<RequestActionButton
140+
label="Save securely"
141+
disabled={submitting || secret.trim().length === 0}
142+
onPress={() => void send({ type: "save", secret })}
143+
/>
144+
<View className="flex-row items-center justify-between gap-2">
145+
<View className="flex-1 flex-row items-center gap-1.5">
146+
<SymbolView
147+
name={PRIVATE_SYMBOL}
148+
size={13}
149+
tintColor={props.iconColor}
150+
type="monochrome"
151+
/>
152+
<Text className="flex-1 font-sans text-xs text-foreground-muted">
153+
{SECRET_REQUEST_PRIVACY_NOTE}
154+
</Text>
155+
</View>
156+
{/* Quiet like the web card's: the field and Save are the action. */}
157+
<Pressable
158+
accessibilityRole="button"
159+
accessibilityState={{ disabled: submitting }}
160+
disabled={submitting}
161+
hitSlop={8}
162+
className="px-1 py-1 active:opacity-60 disabled:opacity-50"
163+
onPress={() => void send({ type: "decline" })}
164+
>
165+
<Text className="font-sans text-xs text-foreground-muted">Decline</Text>
166+
</Pressable>
167+
</View>
168+
</View>
169+
);
170+
}
Collapse file

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/ThreadFeed.tsx
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ThreadContextDivider } from "./thread-context-divider";
22
import { ThreadHandoffRow } from "./thread-handoff-row";
3+
import { SecretRequestCard } from "./SecretRequestCard";
34
import {
45
WorktreeWorkingHeader,
56
WorktreeSetupCard,
@@ -162,6 +163,7 @@ import {
162163
threadFeedRunIsUnsettled,
163164
isContextCompactionActivityGroup,
164165
isContextHandoffActivityGroup,
166+
isSecretRequestActivityGroup,
165167
type ThreadFeedEntry,
166168
type ThreadFeedLatestRun,
167169
} from "../../lib/threadActivity";
@@ -1621,6 +1623,16 @@ function renderFeedEntry(
16211623
);
16221624
}
16231625

1626+
if (entry.type === "activity-group" && isSecretRequestActivityGroup(entry)) {
1627+
return (
1628+
<SecretRequestCard
1629+
environmentId={props.environmentId}
1630+
projectedItem={entry.activities[0]!.projectedItem}
1631+
iconColor={iconSubtleColor}
1632+
/>
1633+
);
1634+
}
1635+
16241636
if (entry.type === "activity-group" && isContextCompactionActivityGroup(entry)) {
16251637
const label = entry.activities[0]!.summary;
16261638
const active =
Collapse file

‎apps/mobile/src/lib/threadActivity.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/lib/threadActivity.ts
+20-1Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,13 @@ export function isContextHandoffActivityGroup(entry: ThreadFeedActivityGroup): b
321321
);
322322
}
323323

324+
export function isSecretRequestActivityGroup(entry: ThreadFeedActivityGroup): boolean {
325+
return (
326+
entry.activities.length === 1 &&
327+
entry.activities[0]?.projectedItem.item.type === "secret_request"
328+
);
329+
}
330+
324331
function isUserInputActivityGroup(entry: ThreadFeedActivityGroup): boolean {
325332
return entry.activities.some((activity) => activity.workEntry.questionAnswer !== undefined);
326333
}
@@ -420,7 +427,13 @@ function itemIsToolLike(item: OrchestrationV2TurnItem): boolean {
420427
}
421428

422429
function itemIsProminent(item: OrchestrationV2TurnItem): boolean {
423-
return item.type === "fork" || item.type === "thread_created" || item.type === "system_notice";
430+
return (
431+
item.type === "fork" ||
432+
item.type === "thread_created" ||
433+
item.type === "system_notice" ||
434+
// An answerable card: it must stand alone and never fold away with the run.
435+
item.type === "secret_request"
436+
);
424437
}
425438

426439
function itemStatus(item: OrchestrationV2TurnItem): ThreadFeedActivity["status"] {
@@ -537,6 +550,8 @@ function itemIcon(item: OrchestrationV2TurnItem): ThreadFeedActivity["icon"] {
537550
case "fork":
538551
case "thread_created":
539552
return "zap";
553+
case "secret_request":
554+
return "lock";
540555
}
541556
}
542557

@@ -590,6 +605,8 @@ function itemSummary(
590605
return "Thread forked";
591606
case "thread_created":
592607
return "Thread created";
608+
case "secret_request":
609+
return item.label;
593610
case "dynamic_tool": {
594611
const classified = classifyToolActivity({
595612
itemType: "dynamic_tool_call",
@@ -647,6 +664,8 @@ function itemPreview(item: OrchestrationV2TurnItem): string | null {
647664
case "fork":
648665
case "thread_created":
649666
return item.targetThreadId;
667+
case "secret_request":
668+
return item.reason || null;
650669
case "subagent":
651670
return item.result ?? item.progress ?? item.prompt;
652671
case "dynamic_tool":
Collapse file

‎apps/server/src/auth/RpcAuthorization.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/auth/RpcAuthorization.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const RPC_REQUIRED_SCOPES = {
9696
[WS_METHODS.scheduledTasksDelete]: AuthOrchestrationOperateScope,
9797
[WS_METHODS.scheduledTasksRunNow]: AuthOrchestrationOperateScope,
9898
[WS_METHODS.scheduledTasksRotateWebhookToken]: AuthOrchestrationOperateScope,
99+
[WS_METHODS.secretsAnswerRequest]: AuthOrchestrationOperateScope,
99100
// Delivery logs hold request bodies, so they need the same scope as the URL.
100101
[WS_METHODS.scheduledTasksListWebhookDeliveries]: AuthOrchestrationOperateScope,
101102
[WS_METHODS.scheduledTasksGetWebhookDelivery]: AuthOrchestrationOperateScope,
Collapse file

‎apps/server/src/mcp/OrchestratorMcpService.activity.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/mcp/OrchestratorMcpService.activity.test.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import * as ProviderAdapterRegistry from "../orchestration-v2/ProviderAdapterReg
2020
import * as ProviderRegistry from "../provider/Services/ProviderRegistry.ts";
2121
import * as ProjectService from "../project/ProjectService.ts";
2222
import * as ScheduledTaskService from "../scheduledTasks/ScheduledTaskService.ts";
23+
import * as SecretRequests from "../secrets/SecretRequests.ts";
2324
import * as ThreadManagementService from "../orchestration-v2/ThreadManagementService.ts";
2425
import type * as McpInvocationContext from "./McpInvocationContext.ts";
2526
import * as OrchestratorMcpService from "./OrchestratorMcpService.ts";
@@ -149,6 +150,7 @@ it("readThread prefers activity-run status over a newer cancelled queued run", a
149150
getProviders: Effect.succeed([]),
150151
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
151152
Layer.mock(ProjectService.ProjectService)({}),
153+
Layer.mock(SecretRequests.SecretRequests)({}),
152154
Layer.mock(ScheduledTaskService.ScheduledTaskService)({
153155
list: () => Effect.succeed({ tasks: [] }),
154156
} satisfies Partial<ScheduledTaskService.ScheduledTaskService["Service"]>),
@@ -213,6 +215,7 @@ it("readThread prefers waiting activity status over a newer cancelled queued run
213215
getProviders: Effect.succeed([]),
214216
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
215217
Layer.mock(ProjectService.ProjectService)({}),
218+
Layer.mock(SecretRequests.SecretRequests)({}),
216219
Layer.mock(ScheduledTaskService.ScheduledTaskService)({
217220
list: () => Effect.succeed({ tasks: [] }),
218221
} satisfies Partial<ScheduledTaskService.ScheduledTaskService["Service"]>),
@@ -325,6 +328,7 @@ it("taskStatus returns task.providerInstanceId rather than the driver kind", asy
325328
getProviders: Effect.succeed([]),
326329
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
327330
Layer.mock(ProjectService.ProjectService)({}),
331+
Layer.mock(SecretRequests.SecretRequests)({}),
328332
Layer.mock(ScheduledTaskService.ScheduledTaskService)({
329333
list: () => Effect.succeed({ tasks: [] }),
330334
} satisfies Partial<ScheduledTaskService.ScheduledTaskService["Service"]>),
@@ -447,6 +451,7 @@ it("readThread and sendToThread reach threads in other projects", async () => {
447451
getProviders: Effect.succeed([]),
448452
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
449453
Layer.mock(ProjectService.ProjectService)({}),
454+
Layer.mock(SecretRequests.SecretRequests)({}),
450455
Layer.mock(ScheduledTaskService.ScheduledTaskService)({
451456
list: () =>
452457
Effect.succeed({

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.