Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/server/src/orchestration-v2/AgentOutputGate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
const OUTPUT_GATE_BOUNCE_MESSAGE_PREFIX = "message:output-gate-bounce:";

export const OUTPUT_GATE_BOUNCE_PROMPT =
"Triggered by an agent/automation wake, not the user — plain assistant text stays folded and is not delivered. Route your response now: call `send_to_user` if it is for the founder, `t3_thread_send` or `ask_agent` if it is for another agent, or `silent_ack` if nothing needs delivery.";
"Triggered by an agent/automation wake, not the user. Plain assistant text stays folded and is not delivered. Route your response now: call `send_to_user` if it is for the founder, `t3_thread_send` or `ask_agent` if it is for another agent, or `silent_ack` if nothing needs delivery.";

const EXPLICIT_CHANNEL_TOOL_IDS: ReadonlySet<string> = new Set([
SEND_TO_USER_TOOL_NAME,
Expand All @@ -35,7 +35,7 @@ export function outputGateBounceMessageId(runId: RunId): MessageId {
return MessageId.make(`${OUTPUT_GATE_BOUNCE_MESSAGE_PREFIX}${runId}`);
}

export function isOutputGateBounceMessageId(messageId: MessageId | null | undefined): boolean {
function isOutputGateBounceMessageId(messageId: MessageId | null | undefined): boolean {
return typeof messageId === "string" && messageId.startsWith(OUTPUT_GATE_BOUNCE_MESSAGE_PREFIX);
}

Expand All @@ -55,7 +55,7 @@ export function isExplicitChannelToolName(toolName: string | null | undefined):
* Only async agent/automation-originated turns are eligible for the turn-end output gate.
* Human user turns (`createdBy === "user"` with no agent/automation wake metadata) are never gated.
*/
export function isAgentOriginatedWake(
function isAgentOriginatedWake(
message:
| Pick<
OrchestrationV2ConversationMessage,
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/peer/RemoteDelegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ const FOLLOW_MAX_BACKOFF = Duration.minutes(5);
/** A follower that hits this many defects in a row fails its task instead of retrying. */
const FOLLOW_MAX_DEFECTS = 3;
/** How long a remote task may go without peer contact while polls fail before reporting unreachable. */
export const REMOTE_PEER_UNREACHABLE_THRESHOLD = Duration.minutes(2);
const REMOTE_PEER_UNREACHABLE_THRESHOLD = Duration.minutes(2);
/** How long without successful peer contact while failing before reporting unreachable; tests may override. */
export const PeerUnreachableThreshold = Context.Reference<Duration.Duration>(
const PeerUnreachableThreshold = Context.Reference<Duration.Duration>(
"t3/peer/RemoteDelegation/PeerUnreachableThreshold",
{
defaultValue: () => REMOTE_PEER_UNREACHABLE_THRESHOLD,
Expand Down
31 changes: 19 additions & 12 deletions apps/server/src/security/secretRedaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,37 @@ export function redactSecretText(input: string): SecretRedactionResult {
redactedCount += 1;
return SECRET_REDACTED;
});
const afterInline = afterValues.replace(INLINE_SECRET_PATTERN, (match, offset: number, full: string) => {
// INLINE_SECRET_PATTERN stops before ']', so values already replaced with
// '[redacted]' match up to '[redacted'. Skip double-counting those.
const prefix = SECRET_REDACTED.slice(0, -1);
if (match.endsWith(prefix) && full[offset + match.length] === "]") {
return match;
}
redactedCount += 1;
return SECRET_REDACTED;
});
const afterInline = afterValues.replace(
INLINE_SECRET_PATTERN,
(match, offset: number, full: string) => {
// INLINE_SECRET_PATTERN stops before ']', so values already replaced with
// '[redacted]' match up to '[redacted'. Skip double-counting those.
const prefix = SECRET_REDACTED.slice(0, -1);
if (match.endsWith(prefix) && full[offset + match.length] === "]") {
return match;
}
redactedCount += 1;
return SECRET_REDACTED;
},
);
return { text: afterInline, redactedCount };
}

export function containsSecret(input: string): boolean {
return redactSecretText(input).redactedCount > 0;
}

export function isCredentialKeyName(key: string): boolean {
function isCredentialKeyName(key: string): boolean {
return CREDENTIAL_KEY_PATTERN.test(key);
}

const MAX_DEEP_DEPTH = 24;

export function redactSecretsDeep(value: unknown, depth = 0, seen = new WeakSet<object>()): unknown {
export function redactSecretsDeep(
value: unknown,
depth = 0,
seen = new WeakSet<object>(),
): unknown {
if (typeof value === "string") {
return redactSecretText(value).text;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Sidebar.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ describe("standing bots bound by a scheduled task", () => {
audience: string,
) => ({
id,
standing,
standing: standing && { ...standing, avatarId: "bolt" as const, accent: "sky" as const },
lineage: { parentThreadId: null, rootThreadId: id, relationshipToParent: null },
source: { inbox: { audience } },
});
Expand Down
13 changes: 10 additions & 3 deletions apps/web/src/components/bots/botOrgTree.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ThreadId } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";

import { isFounderName, orderBotTree, visibleBotRows } from "./botOrgTree";
Expand Down Expand Up @@ -65,10 +66,16 @@ describe("founders are not bots", () => {
});

it("keeps a founder thread out of the Bots shelf", () => {
const lineage = {
parentThreadId: null,
rootThreadId: ThreadId.make("root"),
relationshipToParent: null,
};
const persona = (name: string) => ({ name, avatarId: "bolt", accent: "sky" }) as const;
const { bots, rest } = splitStandingThreads([
{ id: "k", standing: { name: "Kameron" } },
{ id: "c", standing: { name: "CEO" } },
{ id: "w", standing: null },
{ id: "k", lineage, standing: persona("Kameron") },
{ id: "c", lineage, standing: persona("CEO") },
{ id: "w", lineage, standing: null },
]);
expect(bots.map((t) => t.id)).toEqual(["c"]);
expect(rest.map((t) => t.id)).toEqual(["k", "w"]);
Expand Down
3 changes: 3 additions & 0 deletions knip.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
".github/scripts/pr-limits.cjs",
// Upstream release workflows invoke the documented Play APK mirror by path.
".github/scripts/mirror-play-apk.cjs",
// The upstream release workflows (not kept in this fork) invoke the version-bump scripts by path.
".github/scripts/set-mobile-version.cjs",
".github/scripts/set-release-version.cjs",
],
"vite": { "entry": [".github/**/*.test.cjs"] },
"vitest": { "entry": [".github/**/*.test.cjs"] },
Expand Down
Loading