nolo-cli 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/agent-runtime/agentRecordConfig.ts +2 -0
- package/agent-runtime/hostAdapter.ts +1 -0
- package/agent-runtime/index.ts +0 -21
- package/agent-runtime/localToolPolicy.ts +6 -13
- package/agent-runtime/localWorkspaceTools.ts +30 -333
- package/agent-runtime/platformChatProvider.ts +1 -4
- package/agent-runtime/runtimeToolPolicy.ts +47 -32
- package/agentAliases.ts +14 -83
- package/agentCommandSupport.ts +3 -6
- package/agentInternalCommandEntries.ts +2 -13
- package/agentListCommands.ts +19 -28
- package/agentMachineCommands.ts +40 -336
- package/agentPullCommand.ts +36 -56
- package/agentRecordCommands.ts +3 -5
- package/agentRecordHelpers.ts +22 -189
- package/agentRunCommand.ts +438 -107
- package/agentRuntimeLocal.ts +0 -10
- package/ai/agent/cliExecutor.ts +19 -323
- package/authCommands.ts +2 -36
- package/cli/agentAliases.ts +14 -83
- package/cli/agentCommandSupport.ts +3 -6
- package/cli/agentInternalCommandEntries.ts +2 -13
- package/cli/agentListCommands.ts +19 -28
- package/cli/agentMachineCommands.ts +40 -336
- package/cli/agentPullCommand.ts +36 -56
- package/cli/agentRecordCommands.ts +3 -5
- package/cli/agentRecordHelpers.ts +22 -189
- package/cli/agentRunCommand.ts +438 -107
- package/cli/agentRuntimeLocal.ts +0 -10
- package/cli/authCommands.ts +2 -36
- package/cli/cliEnvHelpers.ts +21 -162
- package/cli/client/agentRun.ts +853 -57
- package/cli/client/localRuntimeAdapter.ts +22 -159
- package/cli/client/streamingOutput.ts +3 -1
- package/cli/client/taskRunPrompt.ts +24 -7
- package/cli/commandRegistry.ts +2 -3
- package/cli/connectorRunArtifact.ts +10 -34
- package/cli/connectorWebSocketTarget.ts +6 -10
- package/cli/internalCommandEntries.ts +0 -8
- package/cli/localRuntimeDb.ts +2 -39
- package/cli/machineCommands.ts +189 -190
- package/cli/machineDaemonCommands.ts +165 -9
- package/cli/machineHeartbeatCommands.ts +2 -1
- package/cli/machineStatusCommands.ts +13 -5
- package/cli/machineWatchCommands.ts +1 -1
- package/cli/machineWsRunDispatch.ts +14 -48
- package/cli/machineWsSession.ts +0 -2
- package/cli/offlineMarxistsAgentCommand.ts +314 -0
- package/cli/runtimeDoctorCommands.ts +69 -18
- package/cli/scriptCommandEntries.ts +45 -5
- package/cli/tableCommands.ts +133 -33
- package/cli/taskRunCommand.ts +211 -16
- package/cli/tui/session.ts +372 -43
- package/cli/workflowInternalCommandEntries.ts +0 -20
- package/cliEnvHelpers.ts +21 -162
- package/client/agentConfigResolver.test.ts +2 -0
- package/client/agentRun.test.ts +12 -208
- package/client/agentRun.ts +853 -57
- package/client/localRuntimeAdapter.test.ts +9 -168
- package/client/localRuntimeAdapter.ts +22 -159
- package/client/localToolPolicy.test.ts +4 -28
- package/client/streamingOutput.ts +3 -1
- package/client/taskRunPrompt.ts +24 -7
- package/commandRegistry.ts +2 -3
- package/connectorRunArtifact.ts +10 -34
- package/connectorWebSocketTarget.ts +6 -10
- package/database/server/db.ts +34 -15
- package/internalCommandEntries.ts +0 -8
- package/localRuntimeDb.ts +2 -39
- package/machineCommands.ts +189 -190
- package/machineDaemonCommands.ts +165 -9
- package/machineHeartbeatCommands.ts +2 -1
- package/machineStatusCommands.ts +13 -5
- package/machineWatchCommands.ts +1 -1
- package/machineWsRunDispatch.ts +14 -48
- package/machineWsSession.ts +0 -2
- package/offlineMarxistsAgentCommand.ts +314 -0
- package/package.json +49 -193
- package/runtimeDoctorCommands.ts +69 -18
- package/scriptCommandEntries.ts +45 -5
- package/tableCommands.ts +133 -33
- package/taskRunCommand.ts +211 -16
- package/tui/session.ts +372 -43
- package/workflowInternalCommandEntries.ts +0 -20
- package/agent-runtime/dialogStatus.ts +0 -139
- package/agent-runtime/hostRuntimeConfig.ts +0 -86
- package/agentCreateCustomCommands.ts +0 -278
- package/agentDialogsCommands.ts +0 -227
- package/agentDoctorCommands.ts +0 -203
- package/agentRunLocalWorkspace.ts +0 -182
- package/agentRunParsing.ts +0 -298
- package/agentSuperviseCommands.ts +0 -8
- package/agentUnpublishCommands.ts +0 -113
- package/ai/agent/agentRunDialogLineage.ts +0 -56
- package/ai/policy/types.ts +0 -64
- package/ai/skills/skillSummaryMarker.ts +0 -26
- package/app/types.ts +0 -358
- package/build.ts +0 -16
- package/buildPublish.ts +0 -138
- package/buildPublishArtifactAssembly.ts +0 -724
- package/buildPublishImportAnalysis.ts +0 -242
- package/chat/messages/fetchMessages.ts +0 -84
- package/chat/messages/types.ts +0 -185
- package/cli/agentCreateCustomCommands.ts +0 -278
- package/cli/agentDialogsCommands.ts +0 -227
- package/cli/agentDoctorCommands.ts +0 -203
- package/cli/agentRunLocalWorkspace.ts +0 -182
- package/cli/agentRunParsing.ts +0 -298
- package/cli/agentSuperviseCommands.ts +0 -8
- package/cli/agentUnpublishCommands.ts +0 -113
- package/cli/buildPublish.ts +0 -138
- package/cli/buildPublishArtifactAssembly.ts +0 -724
- package/cli/buildPublishImportAnalysis.ts +0 -242
- package/cli/cliIoTypes.ts +0 -3
- package/cli/cliRuntimeDoctorReport.ts +0 -193
- package/cli/client/agentRunInput.ts +0 -10
- package/cli/client/agentRunLocalExecution.ts +0 -124
- package/cli/client/agentRunLocalExecutor.ts +0 -179
- package/cli/client/agentRunRuntimeSelection.ts +0 -145
- package/cli/client/agentRunServerTransport.ts +0 -397
- package/cli/client/agentRunTaskRunRecorder.ts +0 -176
- package/cli/customCodingAgentFlow.ts +0 -208
- package/cli/customCodingAgentRecord.ts +0 -179
- package/cli/dialogDataAccess.ts +0 -186
- package/cli/dialogInternalCommandEntries.ts +0 -11
- package/cli/dialogReadCommands.ts +0 -180
- package/cli/dialogReadHelpers.ts +0 -226
- package/cli/dialogStatusCommands.ts +0 -123
- package/cli/docInternalCommandEntries.ts +0 -20
- package/cli/hybridReadHelpers.ts +0 -109
- package/cli/machineCommandPrompts.ts +0 -79
- package/cli/machineCommandResolution.ts +0 -43
- package/cli/noloReadBridgePrompt.ts +0 -16
- package/cli/pageCreateCommands.ts +0 -219
- package/cli/pageDeleteCommands.ts +0 -167
- package/cli/pageReadCommands.ts +0 -151
- package/cli/pageUpdateCommands.ts +0 -249
- package/cli/pageWriteHelpers.ts +0 -209
- package/cli/publishPackage.ts +0 -36
- package/cli/runtimeInternalCommandEntries.ts +0 -15
- package/cli/runtimePassthroughCommands.ts +0 -22
- package/cli/scriptPassthroughHelpers.ts +0 -28
- package/cli/secretScanHelpers.ts +0 -31
- package/cli/spaceAttachCommands.ts +0 -134
- package/cli/spaceCategoryCommands.ts +0 -263
- package/cli/spaceCommands.ts +0 -295
- package/cli/spaceDeleteCommands.ts +0 -312
- package/cli/spaceInternalCommandEntries.ts +0 -21
- package/cli/spaceMutationHelpers.ts +0 -135
- package/cli/spaceReadCommands.ts +0 -323
- package/cli/tableDataOutput.ts +0 -41
- package/cli/tableDataSafety.ts +0 -26
- package/cli/tableMetaCommands.ts +0 -307
- package/cli/tableMutationCommands.ts +0 -266
- package/cli/tableQueryParsing.ts +0 -90
- package/cli/tableQueryRequest.ts +0 -53
- package/cli/taskRunActions.ts +0 -122
- package/cli/taskRunParsing.ts +0 -86
- package/cli/taskRunPromptShared.ts +0 -55
- package/cli/tui/tuiCatalog.ts +0 -22
- package/cli/tui/tuiCommandInterpreter.ts +0 -253
- package/cli/tui/tuiPresentation.ts +0 -146
- package/cliIoTypes.ts +0 -3
- package/cliRuntimeDoctorReport.ts +0 -193
- package/client/agentRunInput.ts +0 -10
- package/client/agentRunLocalExecution.test.ts +0 -123
- package/client/agentRunLocalExecution.ts +0 -124
- package/client/agentRunLocalExecutor.ts +0 -179
- package/client/agentRunRuntimeSelection.test.ts +0 -159
- package/client/agentRunRuntimeSelection.ts +0 -145
- package/client/agentRunServerTransport.ts +0 -397
- package/client/agentRunTaskRunRecorder.ts +0 -176
- package/connector-experimental/daemonLauncher.ts +0 -223
- package/create/space/spaceKeys.ts +0 -65
- package/create/types.ts +0 -21
- package/customCodingAgentFlow.ts +0 -208
- package/customCodingAgentRecord.ts +0 -179
- package/database/keys.ts +0 -765
- package/database/server/authorityStoreTypes.ts +0 -31
- package/database/server/legacyServerDb.ts +0 -58
- package/database/server/levelAuthorityStore.ts +0 -75
- package/database/server/memoryAuthorityStore.ts +0 -133
- package/database/server/serverStoreFactory.ts +0 -124
- package/database/tombstones.ts +0 -52
- package/database/utils/ulid.ts +0 -1
- package/dialogDataAccess.ts +0 -186
- package/dialogInternalCommandEntries.ts +0 -11
- package/dialogReadCommands.ts +0 -180
- package/dialogReadHelpers.ts +0 -226
- package/dialogStatusCommands.ts +0 -123
- package/docInternalCommandEntries.ts +0 -20
- package/hybridReadHelpers.ts +0 -109
- package/machineCommandPrompts.ts +0 -79
- package/machineCommandResolution.ts +0 -43
- package/noloReadBridgePrompt.ts +0 -16
- package/pageCreateCommands.ts +0 -219
- package/pageDeleteCommands.ts +0 -167
- package/pageReadCommands.ts +0 -151
- package/pageUpdateCommands.ts +0 -249
- package/pageWriteHelpers.ts +0 -209
- package/publishPackage.ts +0 -36
- package/runtimeInternalCommandEntries.ts +0 -15
- package/runtimePassthroughCommands.ts +0 -22
- package/scriptPassthroughHelpers.ts +0 -28
- package/secretScanHelpers.ts +0 -31
- package/share/helpers.ts +0 -302
- package/share/keys.ts +0 -243
- package/share/types.ts +0 -100
- package/spaceAttachCommands.ts +0 -134
- package/spaceCategoryCommands.ts +0 -263
- package/spaceCommands.ts +0 -295
- package/spaceDeleteCommands.ts +0 -312
- package/spaceInternalCommandEntries.ts +0 -21
- package/spaceMutationHelpers.ts +0 -135
- package/spaceReadCommands.ts +0 -323
- package/tableDataOutput.ts +0 -41
- package/tableDataSafety.ts +0 -26
- package/tableMetaCommands.ts +0 -307
- package/tableMutationCommands.ts +0 -266
- package/tableQueryParsing.ts +0 -90
- package/tableQueryRequest.ts +0 -53
- package/taskRunActions.ts +0 -122
- package/taskRunParsing.ts +0 -86
- package/taskRunPromptShared.ts +0 -55
- package/tui/tuiCatalog.ts +0 -22
- package/tui/tuiCommandInterpreter.test.ts +0 -169
- package/tui/tuiCommandInterpreter.ts +0 -253
- package/tui/tuiPresentation.test.ts +0 -154
- package/tui/tuiPresentation.ts +0 -146
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { formatPreparedTaskWorktree, prepareTaskWorktree, ensureWorkspacePackageLinks } from "./client/taskWorktree";
|
|
2
|
-
import type { PreparedTaskWorktree } from "./client/taskWorktree";
|
|
3
|
-
|
|
4
|
-
export type EnvLike = Record<string, string | undefined>;
|
|
5
|
-
|
|
6
|
-
export type OutputLike = {
|
|
7
|
-
write(chunk: string): unknown;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type LocalRunWorkspaceInspection = {
|
|
11
|
-
cwd: string;
|
|
12
|
-
clean: boolean;
|
|
13
|
-
status: string;
|
|
14
|
-
commit?: {
|
|
15
|
-
hash: string;
|
|
16
|
-
subject: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type LocalWorkspaceRunArgs = {
|
|
21
|
-
agentKey: string;
|
|
22
|
-
runtimeMode?: "local" | "server" | "auto";
|
|
23
|
-
allowShell: boolean;
|
|
24
|
-
useTaskWorktree: boolean;
|
|
25
|
-
cwd?: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type InspectLocalRunWorkspaceDeps = {
|
|
29
|
-
runGitForLocalSummary?: typeof runGitForLocalSummary;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type PrepareLocalRunWorkspaceDeps = {
|
|
33
|
-
parsed: LocalWorkspaceRunArgs;
|
|
34
|
-
env: EnvLike;
|
|
35
|
-
output: OutputLike;
|
|
36
|
-
prepareTaskWorktree?: typeof prepareTaskWorktree;
|
|
37
|
-
ensureWorkspacePackageLinks?: typeof ensureWorkspacePackageLinks;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export async function runGitForLocalSummary(args: {
|
|
41
|
-
cwd: string;
|
|
42
|
-
gitArgs: string[];
|
|
43
|
-
}) {
|
|
44
|
-
const proc = Bun.spawn(["git", ...args.gitArgs], {
|
|
45
|
-
cwd: args.cwd,
|
|
46
|
-
stdout: "pipe",
|
|
47
|
-
stderr: "pipe",
|
|
48
|
-
});
|
|
49
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
50
|
-
new Response(proc.stdout).text(),
|
|
51
|
-
new Response(proc.stderr).text(),
|
|
52
|
-
proc.exited,
|
|
53
|
-
]);
|
|
54
|
-
if (exitCode !== 0) {
|
|
55
|
-
throw new Error((stderr || stdout || `git ${args.gitArgs.join(" ")} failed`).trim());
|
|
56
|
-
}
|
|
57
|
-
return stdout.trim();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function inspectLocalRunWorkspace(
|
|
61
|
-
cwd: string,
|
|
62
|
-
deps: InspectLocalRunWorkspaceDeps = {}
|
|
63
|
-
): Promise<LocalRunWorkspaceInspection> {
|
|
64
|
-
const runGit = deps.runGitForLocalSummary ?? runGitForLocalSummary;
|
|
65
|
-
const status = await runGit({
|
|
66
|
-
cwd,
|
|
67
|
-
gitArgs: ["status", "--short"],
|
|
68
|
-
});
|
|
69
|
-
const rawCommit = await runGit({
|
|
70
|
-
cwd,
|
|
71
|
-
gitArgs: ["log", "-1", "--format=%h%x00%s"],
|
|
72
|
-
}).catch(() => "");
|
|
73
|
-
const [hash, subject] = rawCommit.split("\0");
|
|
74
|
-
return {
|
|
75
|
-
cwd,
|
|
76
|
-
clean: status.trim() === "",
|
|
77
|
-
status,
|
|
78
|
-
...(hash ? { commit: { hash, subject: subject ?? "" } } : {}),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function formatLocalRunSummary(args: {
|
|
83
|
-
dialogId?: string;
|
|
84
|
-
inspection: LocalRunWorkspaceInspection;
|
|
85
|
-
}) {
|
|
86
|
-
return [
|
|
87
|
-
"",
|
|
88
|
-
"[nolo] local run summary",
|
|
89
|
-
`workspace: ${args.inspection.cwd}`,
|
|
90
|
-
...(args.dialogId ? [`dialog: ${args.dialogId}`] : []),
|
|
91
|
-
...(args.inspection.commit
|
|
92
|
-
? [`commit: ${args.inspection.commit.hash} ${args.inspection.commit.subject}`]
|
|
93
|
-
: []),
|
|
94
|
-
`dirty: ${args.inspection.clean ? "clean" : "dirty"}`,
|
|
95
|
-
...(!args.inspection.clean && args.inspection.status.trim()
|
|
96
|
-
? [`status:\n${args.inspection.status.trim()}`]
|
|
97
|
-
: []),
|
|
98
|
-
"",
|
|
99
|
-
].join("\n");
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function shouldPrepareTaskWorktree(parsed: LocalWorkspaceRunArgs) {
|
|
103
|
-
return !parsed.cwd && (parsed.useTaskWorktree || parsed.allowShell);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function buildTaskWorktreeEnv(args: {
|
|
107
|
-
env: EnvLike;
|
|
108
|
-
worktreePath?: string;
|
|
109
|
-
allowShell: boolean;
|
|
110
|
-
}) {
|
|
111
|
-
return {
|
|
112
|
-
...args.env,
|
|
113
|
-
...(args.allowShell ? { NOLO_LOCAL_SHELL_MODE: "worktree" } : {}),
|
|
114
|
-
...(args.worktreePath ? { NOLO_LOCAL_WORKTREE: args.worktreePath } : {}),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function shouldBindLocalWorkspace(args: {
|
|
119
|
-
parsed: LocalWorkspaceRunArgs;
|
|
120
|
-
localRuntimeCwd?: string;
|
|
121
|
-
}) {
|
|
122
|
-
return Boolean(
|
|
123
|
-
args.localRuntimeCwd &&
|
|
124
|
-
(args.parsed.runtimeMode === "local" || args.parsed.allowShell || args.parsed.useTaskWorktree)
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export async function prepareLocalRunWorkspace(
|
|
129
|
-
args: PrepareLocalRunWorkspaceDeps
|
|
130
|
-
): Promise<
|
|
131
|
-
| {
|
|
132
|
-
ok: true;
|
|
133
|
-
localRuntimeCwd?: string;
|
|
134
|
-
runEnv: EnvLike;
|
|
135
|
-
}
|
|
136
|
-
| {
|
|
137
|
-
ok: false;
|
|
138
|
-
exitCode: 1;
|
|
139
|
-
}
|
|
140
|
-
> {
|
|
141
|
-
let localRuntimeCwd = args.parsed.cwd;
|
|
142
|
-
if (shouldPrepareTaskWorktree(args.parsed)) {
|
|
143
|
-
try {
|
|
144
|
-
const preparedWorktree: PreparedTaskWorktree = await (args.prepareTaskWorktree ?? prepareTaskWorktree)({
|
|
145
|
-
agentKey: args.parsed.agentKey,
|
|
146
|
-
env: args.env,
|
|
147
|
-
});
|
|
148
|
-
localRuntimeCwd = preparedWorktree.path;
|
|
149
|
-
args.output.write(formatPreparedTaskWorktree(preparedWorktree));
|
|
150
|
-
} catch (error) {
|
|
151
|
-
args.output.write(
|
|
152
|
-
"[nolo] Could not prepare a local task worktree.\n" +
|
|
153
|
-
"Run from inside a git repository, or set NOLO_LOCAL_WORKTREE to an existing isolated checkout.\n" +
|
|
154
|
-
`Reason: ${error instanceof Error ? error.message : String(error)}\n`
|
|
155
|
-
);
|
|
156
|
-
return { ok: false, exitCode: 1 };
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (shouldBindLocalWorkspace({ parsed: args.parsed, localRuntimeCwd })) {
|
|
160
|
-
try {
|
|
161
|
-
await (args.ensureWorkspacePackageLinks ?? ensureWorkspacePackageLinks)(localRuntimeCwd!);
|
|
162
|
-
} catch (error) {
|
|
163
|
-
args.output.write(
|
|
164
|
-
"[nolo] Dependency preflight failed for local task worktree.\n" +
|
|
165
|
-
"The worktree may have node_modules entries that point outside the task checkout, or paths that cannot be repaired safely.\n" +
|
|
166
|
-
`Reason: ${error instanceof Error ? error.message : String(error)}\n`
|
|
167
|
-
);
|
|
168
|
-
return { ok: false, exitCode: 1 };
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
ok: true,
|
|
173
|
-
...(localRuntimeCwd ? { localRuntimeCwd } : {}),
|
|
174
|
-
runEnv: shouldBindLocalWorkspace({ parsed: args.parsed, localRuntimeCwd })
|
|
175
|
-
? buildTaskWorktreeEnv({
|
|
176
|
-
env: args.env,
|
|
177
|
-
worktreePath: localRuntimeCwd,
|
|
178
|
-
allowShell: args.parsed.allowShell,
|
|
179
|
-
})
|
|
180
|
-
: args.env,
|
|
181
|
-
};
|
|
182
|
-
}
|
package/agentRunParsing.ts
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { extname, resolve } from "node:path";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
buildAgentRunDialogLineageFields,
|
|
6
|
-
normalizeAgentRunDialogLineage,
|
|
7
|
-
} from "./ai/agent/agentRunDialogLineage";
|
|
8
|
-
import { parseSkillDocProtocol, type WorkflowReferenceConfig } from "./ai/skills/skillDocProtocol";
|
|
9
|
-
|
|
10
|
-
import { resolveCliAgentKeyInput } from "./agentAliases";
|
|
11
|
-
import type { AgentRuntimeRequestedMode } from "./agentRuntimeLocal";
|
|
12
|
-
import type { TaskRunPromptContext } from "./client/taskRunPrompt";
|
|
13
|
-
|
|
14
|
-
type ParseAgentRunArgsOptions = {
|
|
15
|
-
readTextFile?: (path: string) => string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ParsedAgentRunArgs = {
|
|
19
|
-
agentKey: string;
|
|
20
|
-
message: string;
|
|
21
|
-
imageUrls: string[];
|
|
22
|
-
allowShell: boolean;
|
|
23
|
-
runtimeMode?: AgentRuntimeRequestedMode;
|
|
24
|
-
continueDialogId?: string;
|
|
25
|
-
spaceId?: string;
|
|
26
|
-
category?: string;
|
|
27
|
-
inheritedFromDialogKey?: string;
|
|
28
|
-
parentDialogId?: string;
|
|
29
|
-
background: boolean;
|
|
30
|
-
noStream: boolean;
|
|
31
|
-
noDefaultTestRoot: boolean;
|
|
32
|
-
cwd?: string;
|
|
33
|
-
maxToolRounds?: number;
|
|
34
|
-
timeoutMs?: number;
|
|
35
|
-
traceTools: boolean;
|
|
36
|
-
useTaskWorktree: boolean;
|
|
37
|
-
taskRunContext?: TaskRunPromptContext;
|
|
38
|
-
workflowRef?: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type ResolvedWorkflowReference = {
|
|
42
|
-
ref: string;
|
|
43
|
-
content: string;
|
|
44
|
-
config?: Partial<WorkflowReferenceConfig>;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const DEFAULT_TEST_ROOT_DIALOG_ID = "01KN6V3MVEQA4Q1PNKVM2W7YY8";
|
|
48
|
-
const DEFAULT_TEST_ROOT_DIALOG_KEY = `dialog-b2e06f801f-${DEFAULT_TEST_ROOT_DIALOG_ID}`;
|
|
49
|
-
const DEFAULT_TEST_DIALOG_CATEGORY_ID = "test-dialogs";
|
|
50
|
-
|
|
51
|
-
function readFlagValue(args: string[], flag: string) {
|
|
52
|
-
const index = args.indexOf(flag);
|
|
53
|
-
if (index < 0) return undefined;
|
|
54
|
-
return args[index + 1];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function readAgentRunInput(args: string[]) {
|
|
58
|
-
const rawInput = readFlagValue(args, "--agent") ?? positionalArgs(args)[0];
|
|
59
|
-
const trimmed = rawInput?.trim();
|
|
60
|
-
return trimmed ? trimmed : undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function readRepeatedFlagValues(args: string[], flag: string) {
|
|
64
|
-
const values: string[] = [];
|
|
65
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
66
|
-
if (args[index] === flag && args[index + 1]) {
|
|
67
|
-
values.push(args[index + 1]);
|
|
68
|
-
index += 1;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return values;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function runtimeModeFromArgs(args: string[]): AgentRuntimeRequestedMode | undefined {
|
|
75
|
-
if (args.includes("--local")) return "local";
|
|
76
|
-
if (args.includes("--server")) return "server";
|
|
77
|
-
if (args.includes("--auto")) return "auto";
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function parseNonNegativeInteger(value: string | undefined) {
|
|
82
|
-
if (!value) return undefined;
|
|
83
|
-
const parsed = Number(value);
|
|
84
|
-
if (!Number.isFinite(parsed) || parsed < 0) return undefined;
|
|
85
|
-
return Math.floor(parsed);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function parsePositiveInteger(value: string | undefined) {
|
|
89
|
-
if (!value) return undefined;
|
|
90
|
-
const parsed = Number(value);
|
|
91
|
-
if (!Number.isFinite(parsed) || parsed <= 0) return undefined;
|
|
92
|
-
return Math.floor(parsed);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function positionalArgs(args: string[]) {
|
|
96
|
-
const values: string[] = [];
|
|
97
|
-
const valuelessFlags = new Set([
|
|
98
|
-
"--local",
|
|
99
|
-
"--server",
|
|
100
|
-
"--auto",
|
|
101
|
-
"--dangerously-allow-shell",
|
|
102
|
-
"--worktree-task",
|
|
103
|
-
"--trace-tools",
|
|
104
|
-
"--bg",
|
|
105
|
-
"--no-stream",
|
|
106
|
-
"--debug",
|
|
107
|
-
"--no-default-test-root",
|
|
108
|
-
]);
|
|
109
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
110
|
-
const arg = args[index];
|
|
111
|
-
if (valuelessFlags.has(arg)) continue;
|
|
112
|
-
if (arg.startsWith("--")) {
|
|
113
|
-
index += 1;
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
values.push(arg);
|
|
117
|
-
}
|
|
118
|
-
return values;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function parseDialogReference(rawInput: string) {
|
|
122
|
-
const normalized = rawInput.trim();
|
|
123
|
-
if (normalized.startsWith("dialog-")) {
|
|
124
|
-
const parts = normalized.split("-");
|
|
125
|
-
return {
|
|
126
|
-
dialogKey: normalized,
|
|
127
|
-
dialogId: parts.at(-1) ?? normalized,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const dialogMatch = normalized.match(/dialog-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)/);
|
|
131
|
-
if (dialogMatch) {
|
|
132
|
-
return {
|
|
133
|
-
dialogKey: `dialog-${dialogMatch[1]}-${dialogMatch[2]}`,
|
|
134
|
-
dialogId: dialogMatch[2],
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
dialogId: normalized,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function workflowRefToCandidatePath(cwd: string, ref: string) {
|
|
143
|
-
const normalized = ref.trim();
|
|
144
|
-
if (!normalized) return "";
|
|
145
|
-
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
146
|
-
const directPath = resolve(cwd, normalized);
|
|
147
|
-
if (existsSync(directPath)) return directPath;
|
|
148
|
-
}
|
|
149
|
-
const fileName = normalized.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "");
|
|
150
|
-
return resolve(cwd, "docs", "workflows", `${fileName}.md`);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function mimeTypeForPath(path: string) {
|
|
154
|
-
switch (extname(path).toLowerCase()) {
|
|
155
|
-
case ".jpg":
|
|
156
|
-
case ".jpeg":
|
|
157
|
-
return "image/jpeg";
|
|
158
|
-
case ".webp":
|
|
159
|
-
return "image/webp";
|
|
160
|
-
case ".gif":
|
|
161
|
-
return "image/gif";
|
|
162
|
-
default:
|
|
163
|
-
return "image/png";
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function parseAgentRunArgs(
|
|
168
|
-
args: string[],
|
|
169
|
-
options: ParseAgentRunArgsOptions = {}
|
|
170
|
-
): ParsedAgentRunArgs | null {
|
|
171
|
-
const agentKey = readFlagValue(args, "--agent") ?? positionalArgs(args)[0];
|
|
172
|
-
const explicitMsg = readFlagValue(args, "--msg");
|
|
173
|
-
const msgFile = readFlagValue(args, "--msg-file");
|
|
174
|
-
const fileMessage = msgFile
|
|
175
|
-
? (options.readTextFile ?? ((path: string) => readFileSync(path, "utf8")))(msgFile)
|
|
176
|
-
: undefined;
|
|
177
|
-
const rawMessage = explicitMsg ?? fileMessage ?? positionalArgs(args).slice(1).join(" ");
|
|
178
|
-
if (!agentKey || !rawMessage.trim()) return null;
|
|
179
|
-
const message = rawMessage.trim();
|
|
180
|
-
const runtimeMode = runtimeModeFromArgs(args);
|
|
181
|
-
const rawContinueDialogId = readFlagValue(args, "--continue") ?? readFlagValue(args, "--dialog");
|
|
182
|
-
const continueDialogId = normalizeAgentRunDialogLineage({
|
|
183
|
-
continueDialogId: rawContinueDialogId,
|
|
184
|
-
}).continueDialogId;
|
|
185
|
-
const spaceId = readFlagValue(args, "--space");
|
|
186
|
-
const category = readFlagValue(args, "--category");
|
|
187
|
-
const inheritedFromDialog = readFlagValue(args, "--inherit-from-dialog");
|
|
188
|
-
const noDefaultTestRoot = args.includes("--no-default-test-root");
|
|
189
|
-
const cwd = readFlagValue(args, "--cwd");
|
|
190
|
-
const maxToolRounds = parseNonNegativeInteger(
|
|
191
|
-
readFlagValue(args, "--max-tool-rounds") ?? readFlagValue(args, "--rounds")
|
|
192
|
-
);
|
|
193
|
-
const timeoutMs = parsePositiveInteger(readFlagValue(args, "--timeout-ms"));
|
|
194
|
-
const inheritedRef = inheritedFromDialog
|
|
195
|
-
? parseDialogReference(inheritedFromDialog)
|
|
196
|
-
: !continueDialogId && !noDefaultTestRoot
|
|
197
|
-
? {
|
|
198
|
-
dialogKey: DEFAULT_TEST_ROOT_DIALOG_KEY,
|
|
199
|
-
dialogId: DEFAULT_TEST_ROOT_DIALOG_ID,
|
|
200
|
-
}
|
|
201
|
-
: undefined;
|
|
202
|
-
const imageUrls = [
|
|
203
|
-
...readRepeatedFlagValues(args, "--image"),
|
|
204
|
-
...readRepeatedFlagValues(args, "--image-url"),
|
|
205
|
-
];
|
|
206
|
-
const useTaskWorktree = args.includes("--worktree-task");
|
|
207
|
-
const workflowRef = readFlagValue(args, "--workflow");
|
|
208
|
-
const taskRowDbKey = readFlagValue(args, "--task-row-dbkey");
|
|
209
|
-
const artifactIds = readFlagValue(args, "--artifact-ids")
|
|
210
|
-
?.split(",")
|
|
211
|
-
.map((item) => item.trim())
|
|
212
|
-
.filter(Boolean);
|
|
213
|
-
return {
|
|
214
|
-
agentKey: resolveCliAgentKeyInput(agentKey),
|
|
215
|
-
message,
|
|
216
|
-
imageUrls,
|
|
217
|
-
allowShell: args.includes("--dangerously-allow-shell"),
|
|
218
|
-
traceTools: args.includes("--trace-tools"),
|
|
219
|
-
useTaskWorktree,
|
|
220
|
-
...(workflowRef ? { workflowRef } : {}),
|
|
221
|
-
...(taskRowDbKey
|
|
222
|
-
? {
|
|
223
|
-
taskRunContext: {
|
|
224
|
-
rowDbKey: taskRowDbKey,
|
|
225
|
-
...(readFlagValue(args, "--task-run-id") ? { taskRunId: readFlagValue(args, "--task-run-id") } : {}),
|
|
226
|
-
...(readFlagValue(args, "--work-item-id") ? { workItemId: readFlagValue(args, "--work-item-id") } : {}),
|
|
227
|
-
...(artifactIds?.length ? { artifactIds } : {}),
|
|
228
|
-
},
|
|
229
|
-
}
|
|
230
|
-
: {}),
|
|
231
|
-
...(runtimeMode ? { runtimeMode } : useTaskWorktree ? { runtimeMode: "local" as const } : {}),
|
|
232
|
-
background: args.includes("--bg"),
|
|
233
|
-
noStream: args.includes("--no-stream"),
|
|
234
|
-
noDefaultTestRoot,
|
|
235
|
-
...buildAgentRunDialogLineageFields({
|
|
236
|
-
continueDialogId,
|
|
237
|
-
inheritedFromDialogKey: inheritedRef?.dialogKey,
|
|
238
|
-
parentDialogId: inheritedRef?.dialogId,
|
|
239
|
-
}),
|
|
240
|
-
...(!continueDialogId && spaceId ? { spaceId } : {}),
|
|
241
|
-
...(category
|
|
242
|
-
? { category }
|
|
243
|
-
: !continueDialogId && !noDefaultTestRoot
|
|
244
|
-
? { category: DEFAULT_TEST_DIALOG_CATEGORY_ID }
|
|
245
|
-
: {}),
|
|
246
|
-
...(cwd ? { cwd } : {}),
|
|
247
|
-
...(typeof maxToolRounds === "number" ? { maxToolRounds } : {}),
|
|
248
|
-
...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export async function resolveWorkflowReference(ref: string, cwd = process.cwd()): Promise<ResolvedWorkflowReference> {
|
|
253
|
-
const path = workflowRefToCandidatePath(cwd, ref);
|
|
254
|
-
if (!path || !existsSync(path)) {
|
|
255
|
-
throw new Error(`Workflow reference not found: ${ref}`);
|
|
256
|
-
}
|
|
257
|
-
const markdown = readFileSync(path, "utf8");
|
|
258
|
-
const parsed = parseSkillDocProtocol(markdown);
|
|
259
|
-
return {
|
|
260
|
-
ref,
|
|
261
|
-
content: parsed.content,
|
|
262
|
-
...(parsed.meta?.workflowConfig ? { config: parsed.meta.workflowConfig } : {}),
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export function prependWorkflowReferencePrompt(message: string, workflow?: ResolvedWorkflowReference): string {
|
|
267
|
-
if (!workflow) return message;
|
|
268
|
-
const config = workflow.config;
|
|
269
|
-
return [
|
|
270
|
-
"AI-native workflow reference:",
|
|
271
|
-
"- This reference is guidance for the agent, not a central workflow engine.",
|
|
272
|
-
`- ref: ${workflow.ref}`,
|
|
273
|
-
...(config?.id ? [`- id: ${config.id}`] : []),
|
|
274
|
-
...(config?.name ? [`- name: ${config.name}`] : []),
|
|
275
|
-
...(config?.defaultAgent ? [`- suggested defaultAgent: ${config.defaultAgent}`] : []),
|
|
276
|
-
...(config?.inputs?.length ? [`- inputs: ${config.inputs.join(", ")}`] : []),
|
|
277
|
-
...(config?.recommendedTools?.length ? [`- recommendedTools: ${config.recommendedTools.join(", ")}`] : []),
|
|
278
|
-
...(config?.requiredTools?.length ? [`- requiredTools: ${config.requiredTools.join(", ")}`] : []),
|
|
279
|
-
...(config?.requiredOutputs?.length ? [`- requiredOutputs: ${config.requiredOutputs.join(", ")}`] : []),
|
|
280
|
-
...(config?.gates?.length ? [`- gates: ${config.gates.join(", ")}`] : []),
|
|
281
|
-
...(config?.contextStrategy ? [`- contextStrategy: ${config.contextStrategy}`] : []),
|
|
282
|
-
...(config?.failureProtocol ? [`- failureProtocol: ${config.failureProtocol}`] : []),
|
|
283
|
-
"",
|
|
284
|
-
"Reference body:",
|
|
285
|
-
workflow.content,
|
|
286
|
-
"",
|
|
287
|
-
"User task:",
|
|
288
|
-
message,
|
|
289
|
-
].join("\n");
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export function normalizeCliImageInput(input: string) {
|
|
293
|
-
if (/^(https?:|data:|file:)/i.test(input)) return input;
|
|
294
|
-
const absolutePath = resolve(input);
|
|
295
|
-
if (!existsSync(absolutePath)) return input;
|
|
296
|
-
const base64 = readFileSync(absolutePath).toString("base64");
|
|
297
|
-
return `data:${mimeTypeForPath(absolutePath)};base64,${base64}`;
|
|
298
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { runScriptPassthrough, type ScriptPassthroughDeps } from "./scriptPassthroughHelpers";
|
|
2
|
-
|
|
3
|
-
export async function runAgentSuperviseCommand(
|
|
4
|
-
args: string[],
|
|
5
|
-
deps: ScriptPassthroughDeps = {}
|
|
6
|
-
) {
|
|
7
|
-
return runScriptPassthrough("scripts/runAutonomousAgent.ts", args, deps);
|
|
8
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { getReadableCliDb, type AgentCommandDeps } from "./agentCommandSupport";
|
|
2
|
-
import {
|
|
3
|
-
deleteDbRecord,
|
|
4
|
-
resolveAgentRecordFromHybridStore,
|
|
5
|
-
writeAgentRecord,
|
|
6
|
-
} from "./agentRecordHelpers";
|
|
7
|
-
import { parseUserIdFromAuthToken, resolveAuthToken, resolveServerUrl } from "./cliEnvHelpers";
|
|
8
|
-
|
|
9
|
-
function readOption(args: string[], flag: string) {
|
|
10
|
-
const index = args.indexOf(flag);
|
|
11
|
-
return index >= 0 ? args[index + 1] : undefined;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function usage() {
|
|
15
|
-
return [
|
|
16
|
-
"Usage:",
|
|
17
|
-
" nolo agent unpublish --id <agentId>",
|
|
18
|
-
"",
|
|
19
|
-
].join("\n");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function runAgentUnpublishCommand(
|
|
23
|
-
args: string[],
|
|
24
|
-
deps: AgentCommandDeps = {}
|
|
25
|
-
) {
|
|
26
|
-
const env = deps.env ?? process.env;
|
|
27
|
-
const output = deps.output ?? process.stdout;
|
|
28
|
-
const agentId = readOption(args, "--id")?.trim();
|
|
29
|
-
|
|
30
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
31
|
-
output.write(`${usage()}\n`);
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
if (!agentId) {
|
|
35
|
-
output.write(`${usage()}\n`);
|
|
36
|
-
return 1;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const authToken = resolveAuthToken(args, env);
|
|
40
|
-
if (!authToken) {
|
|
41
|
-
output.write("[nolo] agent unpublish requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
42
|
-
return 1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const userId = parseUserIdFromAuthToken(authToken);
|
|
46
|
-
if (!userId) {
|
|
47
|
-
output.write("[nolo] agent unpublish could not read userId from AUTH_TOKEN.\n");
|
|
48
|
-
return 1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const db = deps.db ?? await getReadableCliDb(output);
|
|
52
|
-
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
53
|
-
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
54
|
-
const serverUrl = resolveServerUrl(args, env);
|
|
55
|
-
const privateKey = `agent-${userId}-${agentId}`;
|
|
56
|
-
const publicKey = `agent-pub-${agentId}`;
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
const resolved = await resolveAgentRecordFromHybridStore({
|
|
60
|
-
agentInput: privateKey,
|
|
61
|
-
cliArgs: args,
|
|
62
|
-
env,
|
|
63
|
-
db,
|
|
64
|
-
fetchImpl,
|
|
65
|
-
fallbackFetchImpl,
|
|
66
|
-
});
|
|
67
|
-
if (!resolved) {
|
|
68
|
-
throw new Error(`private agent record not found: ${privateKey}`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const nextRecord = {
|
|
72
|
-
...resolved.record,
|
|
73
|
-
isPublic: false,
|
|
74
|
-
updatedAt: Date.now(),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
await writeAgentRecord({
|
|
78
|
-
agentKey: privateKey,
|
|
79
|
-
authToken,
|
|
80
|
-
fallbackFetchImpl,
|
|
81
|
-
fetchImpl,
|
|
82
|
-
serverUrl,
|
|
83
|
-
userId,
|
|
84
|
-
record: nextRecord,
|
|
85
|
-
});
|
|
86
|
-
await db.put(privateKey, {
|
|
87
|
-
...nextRecord,
|
|
88
|
-
dbKey: privateKey,
|
|
89
|
-
key: nextRecord?.key || privateKey,
|
|
90
|
-
serverOrigin: serverUrl,
|
|
91
|
-
});
|
|
92
|
-
output.write(`updated ${privateKey} isPublic=false\n`);
|
|
93
|
-
|
|
94
|
-
const deleteStatus = await deleteDbRecord({
|
|
95
|
-
authToken,
|
|
96
|
-
dbKey: publicKey,
|
|
97
|
-
fallbackFetchImpl,
|
|
98
|
-
fetchImpl,
|
|
99
|
-
serverUrl,
|
|
100
|
-
userId,
|
|
101
|
-
});
|
|
102
|
-
await db.batch([{ type: "del", key: publicKey }]);
|
|
103
|
-
output.write(`${deleteStatus} ${publicKey}\n`);
|
|
104
|
-
return 0;
|
|
105
|
-
} catch (error) {
|
|
106
|
-
output.write(
|
|
107
|
-
`[nolo] agent unpublish failed: ${
|
|
108
|
-
error instanceof Error ? error.message : String(error)
|
|
109
|
-
}\n`
|
|
110
|
-
);
|
|
111
|
-
return 1;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export type AgentRunDialogLineageInput = {
|
|
2
|
-
continueDialogId?: string | null;
|
|
3
|
-
inheritedFromDialogKey?: string | null;
|
|
4
|
-
parentDialogId?: string | null;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type NormalizedAgentRunDialogLineage = {
|
|
8
|
-
continueDialogId?: string;
|
|
9
|
-
inheritedFromDialogKey?: string;
|
|
10
|
-
parentDialogId?: string;
|
|
11
|
-
hasAuthoritativeContinueDialog: boolean;
|
|
12
|
-
hasConflictingLineage: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function pickOptionalString(value: unknown) {
|
|
16
|
-
if (typeof value !== "string") return undefined;
|
|
17
|
-
const normalized = value.trim();
|
|
18
|
-
return normalized.length > 0 ? normalized : undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function hasAuthoritativeContinueDialogId(value: unknown) {
|
|
22
|
-
return pickOptionalString(value) !== undefined;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function normalizeAgentRunDialogLineage(
|
|
26
|
-
input: AgentRunDialogLineageInput
|
|
27
|
-
): NormalizedAgentRunDialogLineage {
|
|
28
|
-
const continueDialogId = pickOptionalString(input.continueDialogId);
|
|
29
|
-
const inheritedFromDialogKey = pickOptionalString(input.inheritedFromDialogKey);
|
|
30
|
-
const parentDialogId = pickOptionalString(input.parentDialogId);
|
|
31
|
-
const hasAuthoritativeContinueDialog = hasAuthoritativeContinueDialogId(continueDialogId);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
continueDialogId,
|
|
35
|
-
inheritedFromDialogKey: hasAuthoritativeContinueDialog ? undefined : inheritedFromDialogKey,
|
|
36
|
-
parentDialogId: hasAuthoritativeContinueDialog ? undefined : parentDialogId,
|
|
37
|
-
hasAuthoritativeContinueDialog,
|
|
38
|
-
hasConflictingLineage:
|
|
39
|
-
hasAuthoritativeContinueDialog && Boolean(inheritedFromDialogKey || parentDialogId),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function buildAgentRunDialogLineageFields(
|
|
44
|
-
input: AgentRunDialogLineageInput
|
|
45
|
-
): Pick<AgentRunDialogLineageInput, "continueDialogId" | "inheritedFromDialogKey" | "parentDialogId"> {
|
|
46
|
-
const normalized = normalizeAgentRunDialogLineage(input);
|
|
47
|
-
return {
|
|
48
|
-
...(hasAuthoritativeContinueDialogId(normalized.continueDialogId)
|
|
49
|
-
? { continueDialogId: normalized.continueDialogId }
|
|
50
|
-
: {}),
|
|
51
|
-
...(normalized.inheritedFromDialogKey
|
|
52
|
-
? { inheritedFromDialogKey: normalized.inheritedFromDialogKey }
|
|
53
|
-
: {}),
|
|
54
|
-
...(normalized.parentDialogId ? { parentDialogId: normalized.parentDialogId } : {}),
|
|
55
|
-
};
|
|
56
|
-
}
|