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
package/ai/policy/types.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export type TonePreset =
|
|
2
|
-
| "default"
|
|
3
|
-
| "professional"
|
|
4
|
-
| "friendly"
|
|
5
|
-
| "direct"
|
|
6
|
-
| "pragmatic";
|
|
7
|
-
|
|
8
|
-
export type ToneResolutionMode = "agent_first" | "user_first" | "blend";
|
|
9
|
-
|
|
10
|
-
export type KnowledgeCaptureLevel = 1 | 2 | 3 | 4;
|
|
11
|
-
export type SpaceContextLevel = 1 | 2 | 3 | 4;
|
|
12
|
-
|
|
13
|
-
export type SelfEvolutionMode =
|
|
14
|
-
| "none"
|
|
15
|
-
| "knowledge_only"
|
|
16
|
-
| "prompt_and_refs"
|
|
17
|
-
| "full";
|
|
18
|
-
|
|
19
|
-
export interface AgentBasePolicy {
|
|
20
|
-
version: 1;
|
|
21
|
-
tone?: {
|
|
22
|
-
preset?: TonePreset;
|
|
23
|
-
resolutionMode?: ToneResolutionMode;
|
|
24
|
-
};
|
|
25
|
-
knowledgeCaptureMaxLevel: KnowledgeCaptureLevel;
|
|
26
|
-
spaceContextMaxLevel: SpaceContextLevel;
|
|
27
|
-
selfEvolutionMode: SelfEvolutionMode;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface UserPreferenceProfile {
|
|
31
|
-
version: 1;
|
|
32
|
-
tone?: {
|
|
33
|
-
preset?: TonePreset;
|
|
34
|
-
};
|
|
35
|
-
knowledgeCaptureLevel: KnowledgeCaptureLevel;
|
|
36
|
-
spaceContextLevel: SpaceContextLevel;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface DialogPolicyState {
|
|
40
|
-
autoKnowledgeCaptureCount?: number;
|
|
41
|
-
autoSpaceReadCount?: number;
|
|
42
|
-
updatedAt?: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const DEFAULT_AGENT_BASE_POLICY: AgentBasePolicy = {
|
|
46
|
-
version: 1,
|
|
47
|
-
tone: {
|
|
48
|
-
preset: "default",
|
|
49
|
-
resolutionMode: "blend",
|
|
50
|
-
},
|
|
51
|
-
knowledgeCaptureMaxLevel: 4,
|
|
52
|
-
spaceContextMaxLevel: 4,
|
|
53
|
-
selfEvolutionMode: "knowledge_only",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const DEFAULT_USER_PREFERENCE_PROFILE: UserPreferenceProfile = {
|
|
57
|
-
version: 1,
|
|
58
|
-
tone: {
|
|
59
|
-
preset: "default",
|
|
60
|
-
},
|
|
61
|
-
knowledgeCaptureLevel: 2,
|
|
62
|
-
spaceContextLevel: 3,
|
|
63
|
-
};
|
|
64
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { PageSkillMetadata } from "./skillDocProtocol";
|
|
2
|
-
import type { SpaceContent } from "../../app/types";
|
|
3
|
-
|
|
4
|
-
export type SkillSummaryMarker = NonNullable<SpaceContent["skillSummary"]>;
|
|
5
|
-
|
|
6
|
-
export const buildSkillSummaryMarker = (
|
|
7
|
-
meta?: PageSkillMetadata | null
|
|
8
|
-
): SkillSummaryMarker | null => {
|
|
9
|
-
const skillConfig = meta?.skillConfig;
|
|
10
|
-
if (meta?.kind !== "skill" && !skillConfig) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
isSkill: true,
|
|
16
|
-
...(skillConfig?.id ? { skillId: skillConfig.id } : {}),
|
|
17
|
-
...(skillConfig?.name ? { name: skillConfig.name } : {}),
|
|
18
|
-
...(skillConfig?.description ? { description: skillConfig.description } : {}),
|
|
19
|
-
...(skillConfig?.toolNames?.length ? { toolNames: skillConfig.toolNames } : {}),
|
|
20
|
-
...(skillConfig?.triggerMode ? { triggerMode: skillConfig.triggerMode } : {}),
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const isSkillSummaryMarker = (
|
|
25
|
-
value: SpaceContent["skillSummary"] | undefined | null
|
|
26
|
-
): value is SkillSummaryMarker => Boolean(value?.isSkill);
|
package/app/types.ts
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
// packages/app/types.ts
|
|
2
|
-
import type { UiOption, OpenAIImageContent } from "../chat/messages/types";
|
|
3
|
-
import { DataType } from "../create/types";
|
|
4
|
-
import type {
|
|
5
|
-
AgentBasePolicy,
|
|
6
|
-
DialogPolicyState,
|
|
7
|
-
} from "../ai/policy/types";
|
|
8
|
-
|
|
9
|
-
export type ULID = string;
|
|
10
|
-
|
|
11
|
-
export type DialogRuntimeController =
|
|
12
|
-
| "request"
|
|
13
|
-
| "scheduler"
|
|
14
|
-
| "server-supervisor"
|
|
15
|
-
| "external-supervisor";
|
|
16
|
-
|
|
17
|
-
export type DialogRuntimeProfile = "autonomous";
|
|
18
|
-
|
|
19
|
-
export interface DialogRuntimeBinding {
|
|
20
|
-
version: 1;
|
|
21
|
-
/** 当前 product runtime 的 tenant 边界;本地模型 watchdog 不属于这里。 */
|
|
22
|
-
tenantUserId?: string | null;
|
|
23
|
-
agentKey: string;
|
|
24
|
-
/** 当前长期 runtime 的 durable anchor;现阶段直接复用 dialog。 */
|
|
25
|
-
runtimeAnchorDialogId: string;
|
|
26
|
-
controller: DialogRuntimeController;
|
|
27
|
-
triggerType?: "user" | "api" | "localhost" | "scheduled_run";
|
|
28
|
-
executionMode?: "foreground" | "background";
|
|
29
|
-
runtimeProfile?: DialogRuntimeProfile;
|
|
30
|
-
spaceId?: string;
|
|
31
|
-
category?: string;
|
|
32
|
-
/** Effective runtime/tool policy snapshot for this dialog run. */
|
|
33
|
-
runtimeToolPolicySnapshot?: Record<string, unknown>;
|
|
34
|
-
/** Workspace lease/session used by machine or workspace-backed tools. */
|
|
35
|
-
workspaceLease?: Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface AgentRuntimeBinding {
|
|
39
|
-
machineId?: string | null;
|
|
40
|
-
ownerUserId?: string | null;
|
|
41
|
-
requiredCapabilities?: string[] | null;
|
|
42
|
-
runtimeToolPolicy?: Record<string, unknown> | null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface DialogGoalState {
|
|
46
|
-
objective: string;
|
|
47
|
-
status: "active" | "complete";
|
|
48
|
-
tokenBudget?: number;
|
|
49
|
-
createdAt: number;
|
|
50
|
-
completedAt?: number;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface DialogSubjectRef {
|
|
54
|
-
kind: "table-row" | "page" | "dialog" | "asset" | "external" | string;
|
|
55
|
-
id: string;
|
|
56
|
-
role?: "subject" | "parent" | "work-item" | "artifact" | string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface DialogConfig {
|
|
60
|
-
id: string; // 对话的唯一标识符/路径
|
|
61
|
-
type: DataType.DIALOG; // 数据类型标记
|
|
62
|
-
title: string; // 对话标题
|
|
63
|
-
cybots: string[]; // 兼容字段:当前对话参与的 agent ID 列表
|
|
64
|
-
primaryAgentKey?: string;
|
|
65
|
-
taskLabel?: string;
|
|
66
|
-
tags?: string[];
|
|
67
|
-
createdAt: string; // 创建时间戳
|
|
68
|
-
updatedAt: string; // 最后更新时间戳
|
|
69
|
-
dbKey?: string;
|
|
70
|
-
spaceId?: string;
|
|
71
|
-
category?: string;
|
|
72
|
-
|
|
73
|
-
// --- 上下文压缩 ---
|
|
74
|
-
summary?: string; // 对话摘要(单层覆盖式)
|
|
75
|
-
summarizedBeforeId?: string; // 摘要覆盖到哪条消息 ID
|
|
76
|
-
proactiveSummary?: string; // 主动工作摘要(不裁剪原始消息,供被动压缩消费)
|
|
77
|
-
proactiveSummaryBeforeId?: string; // 主动工作摘要覆盖到哪条消息 ID
|
|
78
|
-
compressionCount?: number; // 压缩次数(用于极端情况提示)
|
|
79
|
-
referenceKeys?: string[]; // 消息中引用过的 pageKey/dialogKey(替代 historyKeys 扫描)
|
|
80
|
-
inheritedFromDialogKey?: string; // 若从旧对话开启,记录来源对话 key 以便刷新后仍可提示
|
|
81
|
-
inheritedFromDialogTitle?: string; // 来源对话标题快照,用于 UI 提示
|
|
82
|
-
summaryPending?: boolean; // 摘要任务是否挂起(因快速切换等原因)
|
|
83
|
-
inputTokens?: number;
|
|
84
|
-
outputTokens?: number;
|
|
85
|
-
maxTokens?: number; // 此对话最大回复 token 数,覆盖 agent 默认值
|
|
86
|
-
|
|
87
|
-
// --- 执行模式(API/后台/定时场景扩展,前台对话不填) ---
|
|
88
|
-
/** 谁触发的:user=用户前台输入 api=外部API调用 localhost=本机调用 scheduled_run=定时任务运行 */
|
|
89
|
-
triggerType?: "user" | "api" | "localhost" | "scheduled_run";
|
|
90
|
-
/** foreground=用户等结果(流式) background=后台静默执行 */
|
|
91
|
-
executionMode?: "foreground" | "background";
|
|
92
|
-
/** 仅 background/scheduled 场景有意义 */
|
|
93
|
-
status?: "pending" | "running" | "done" | "failed" | "cancelled";
|
|
94
|
-
scheduledAt?: number; // 定时任务预定执行时间戳
|
|
95
|
-
startedAt?: number;
|
|
96
|
-
finishedAt?: number;
|
|
97
|
-
durationMs?: number;
|
|
98
|
-
toolCallCount?: number;
|
|
99
|
-
totalCost?: number;
|
|
100
|
-
cliSessionId?: string;
|
|
101
|
-
/** multi-agent: 当前 dialog 由哪个父 dialog 发起 */
|
|
102
|
-
parentDialogId?: string;
|
|
103
|
-
/** multi-agent: 这棵 dialog 执行树的根 dialog,便于查询 fanout */
|
|
104
|
-
rootDialogId?: string;
|
|
105
|
-
/** 当前 dialog 关联的业务对象;保持行业中立,不只服务任务表 */
|
|
106
|
-
subjectRefs?: DialogSubjectRef[];
|
|
107
|
-
/** 定时任务运行产生的对话归属的任务 key */
|
|
108
|
-
parentTaskKey?: string;
|
|
109
|
-
/** 定时任务去重 key */
|
|
110
|
-
idempotencyKey?: string;
|
|
111
|
-
/** cron 表达式,用于重复执行,如 "0 2 * * *" */
|
|
112
|
-
schedule?: string;
|
|
113
|
-
/** 定时任务执行的指令(不同于对话内容,是固定的任务描述) */
|
|
114
|
-
taskPrompt?: string;
|
|
115
|
-
policyState?: DialogPolicyState;
|
|
116
|
-
runtimeBinding?: DialogRuntimeBinding;
|
|
117
|
-
goal?: DialogGoalState;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface ScheduledTaskConfig {
|
|
121
|
-
id: string;
|
|
122
|
-
dbKey: string;
|
|
123
|
-
type: DataType.TASK;
|
|
124
|
-
title: string;
|
|
125
|
-
agentKey: string;
|
|
126
|
-
cybots: string[];
|
|
127
|
-
createdBy: string;
|
|
128
|
-
createdAt: string;
|
|
129
|
-
updatedAt: string;
|
|
130
|
-
spaceId?: string;
|
|
131
|
-
status: "active" | "paused" | "cancelled";
|
|
132
|
-
runStatus?: "idle" | "running" | "done" | "failed";
|
|
133
|
-
schedule: string;
|
|
134
|
-
taskPrompt: string;
|
|
135
|
-
nextRunAt: number;
|
|
136
|
-
lastRunAt?: number;
|
|
137
|
-
lastRunDialogKey?: string;
|
|
138
|
-
lastRunError?: string;
|
|
139
|
-
runDialogKeys?: string[];
|
|
140
|
-
}
|
|
141
|
-
export type ReferenceItem = {
|
|
142
|
-
dbKey: string;
|
|
143
|
-
title: string;
|
|
144
|
-
type: "knowledge" | "instruction";
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export interface AgentGreetingMenuItem extends UiOption {
|
|
149
|
-
/** 以后如果想在 UI 上做分组,可以用 group;现在先不实现 UI */
|
|
150
|
-
group?: string;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Agent 的富 greeting:
|
|
156
|
-
* - text: 打招呼文案(markdown)
|
|
157
|
-
* - menu: 初始菜单项(会显示成第一条消息下方的按钮)
|
|
158
|
-
*/
|
|
159
|
-
export interface AgentGreetingConfig {
|
|
160
|
-
text?: string;
|
|
161
|
-
menu?: AgentGreetingMenuItem[];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
export type PublicImageAgentMode = "generate" | "edit" | "continuous";
|
|
167
|
-
|
|
168
|
-
export interface Agent {
|
|
169
|
-
/**
|
|
170
|
-
* Image workflow mode for this agent.
|
|
171
|
-
* - generate: text-to-image
|
|
172
|
-
* - edit: image editing
|
|
173
|
-
* - continuous: multi-step/interactive image workflows
|
|
174
|
-
*/
|
|
175
|
-
imageWorkflow?: PublicImageAgentMode;
|
|
176
|
-
// --- 你已有的所有字段 ---
|
|
177
|
-
provider: string;
|
|
178
|
-
model: string;
|
|
179
|
-
imageModel?: string;
|
|
180
|
-
/** 执行来源:platform=平台API custom=自定义API/本地 cli=命令行工具 */
|
|
181
|
-
apiSource?: "platform" | "custom" | "cli";
|
|
182
|
-
/** cli 时指定使用哪个 CLI 工具。CLI 可复用 prompt/model/最近文本历史,但不走本地 tool 协议。 */
|
|
183
|
-
cliProvider?: "copilot" | "gemini" | "codex" | "claude" | "agy";
|
|
184
|
-
prompt?: string;
|
|
185
|
-
name?: string;
|
|
186
|
-
[key: string]: any;
|
|
187
|
-
tools?: string[];
|
|
188
|
-
userId: string;
|
|
189
|
-
useServerProxy: boolean;
|
|
190
|
-
apiKey?: string;
|
|
191
|
-
apiKeyFromAgentKey?: string;
|
|
192
|
-
customProviderUrl?: string;
|
|
193
|
-
temperature?: number;
|
|
194
|
-
top_p?: number;
|
|
195
|
-
frequency_penalty?: number;
|
|
196
|
-
presence_penalty?: number;
|
|
197
|
-
max_tokens?: number;
|
|
198
|
-
reasoning_effort?: string;
|
|
199
|
-
enableThinking?: boolean;
|
|
200
|
-
thinkingBudget?: number;
|
|
201
|
-
updatedAt: string;
|
|
202
|
-
createdAt: number;
|
|
203
|
-
categoryId?: string;
|
|
204
|
-
spaceId?: string;
|
|
205
|
-
references?: ReferenceItem[];
|
|
206
|
-
tags?: string[];
|
|
207
|
-
tokenCount?: number;
|
|
208
|
-
messageCount?: number;
|
|
209
|
-
dialogCount?: number;
|
|
210
|
-
outputPrice?: number;
|
|
211
|
-
inputPrice?: number;
|
|
212
|
-
introduction?: string;
|
|
213
|
-
cover?: string;
|
|
214
|
-
greeting?: string | AgentGreetingConfig; // ✅ 这里改成联合类型
|
|
215
|
-
isPublic: boolean;
|
|
216
|
-
endpointKey?: string;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
imageConfig?: {
|
|
220
|
-
enabled?: boolean;
|
|
221
|
-
aspectRatio?:
|
|
222
|
-
| "1:1"
|
|
223
|
-
| "2:3"
|
|
224
|
-
| "3:2"
|
|
225
|
-
| "3:4"
|
|
226
|
-
| "4:3"
|
|
227
|
-
| "4:5"
|
|
228
|
-
| "5:4"
|
|
229
|
-
| "9:16"
|
|
230
|
-
| "16:9"
|
|
231
|
-
| "21:9";
|
|
232
|
-
imageSize?: "1K" | "2K" | "4K";
|
|
233
|
-
forceModalities?: Array<"text" | "image">;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
whitelist?: string[];
|
|
237
|
-
|
|
238
|
-
// Cross-Space Context: 关联的其他 Space ID 列表
|
|
239
|
-
// Agent 可以访问这些 Space 的内容作为粗略上下文
|
|
240
|
-
linkedSpaces?: string[];
|
|
241
|
-
basePolicy?: AgentBasePolicy;
|
|
242
|
-
runtimeBinding?: AgentRuntimeBinding | null;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// --- 内容相关 (核心修改处) ---
|
|
248
|
-
|
|
249
|
-
export interface SpaceContent {
|
|
250
|
-
title: string;
|
|
251
|
-
type: ContentType;
|
|
252
|
-
contentKey: string; // 唯一标识符 (通常是 dbKey)
|
|
253
|
-
fileCategory?: FileCategory;
|
|
254
|
-
mimeType?: string;
|
|
255
|
-
fileSize?: number;
|
|
256
|
-
originalName?: string;
|
|
257
|
-
|
|
258
|
-
// --- 修改: categoryId 变为可选 ---
|
|
259
|
-
categoryId?: string; // 属性不存在或值为 undefined 代表未分类
|
|
260
|
-
|
|
261
|
-
pinned: boolean;
|
|
262
|
-
createdAt: number; // 时间戳 (number)
|
|
263
|
-
updatedAt: number; // 时间戳 (number)
|
|
264
|
-
order?: number; // 分类内排序
|
|
265
|
-
tags?: string[]; // 保留 tags 字段
|
|
266
|
-
triggerType?: string;
|
|
267
|
-
skillSummary?: {
|
|
268
|
-
isSkill: true;
|
|
269
|
-
skillId?: string;
|
|
270
|
-
name?: string;
|
|
271
|
-
description?: string;
|
|
272
|
-
toolNames?: string[];
|
|
273
|
-
triggerMode?: "explicit" | "required" | "recommended";
|
|
274
|
-
} | null;
|
|
275
|
-
} // --- 主数据结构 (SpaceData 保持不变) ---
|
|
276
|
-
|
|
277
|
-
export interface SpaceData {
|
|
278
|
-
id: ULID;
|
|
279
|
-
name: string;
|
|
280
|
-
description: string;
|
|
281
|
-
ownerId: string;
|
|
282
|
-
visibility: SpaceVisibility;
|
|
283
|
-
members: string[]; // userId 列表
|
|
284
|
-
categories: Categories;
|
|
285
|
-
contents: Contents;
|
|
286
|
-
createdAt: number;
|
|
287
|
-
updatedAt: number;
|
|
288
|
-
}
|
|
289
|
-
export enum ContentType {
|
|
290
|
-
DIALOG = "dialog",
|
|
291
|
-
DOC = "page",
|
|
292
|
-
FILE = "file",
|
|
293
|
-
IMAGE = "image",
|
|
294
|
-
AGENT = "agent",
|
|
295
|
-
APP = "app",
|
|
296
|
-
TASK = "task",
|
|
297
|
-
} // --- 枚举 (保持不变) ---
|
|
298
|
-
export type FileCategory =
|
|
299
|
-
| "image"
|
|
300
|
-
| "document"
|
|
301
|
-
| "video"
|
|
302
|
-
| "audio"
|
|
303
|
-
| "other";
|
|
304
|
-
export enum SpaceVisibility {
|
|
305
|
-
PRIVATE = "private",
|
|
306
|
-
PUBLIC = "public",
|
|
307
|
-
}
|
|
308
|
-
export enum MemberRole {
|
|
309
|
-
OWNER = "owner",
|
|
310
|
-
ADMIN = "admin",
|
|
311
|
-
MEMBER = "member",
|
|
312
|
-
GUEST = "guest",
|
|
313
|
-
}
|
|
314
|
-
export type Categories = Record<string, Category | null>; // --- 分类相关 (Category, Categories 保持不变) ---
|
|
315
|
-
export interface Category {
|
|
316
|
-
name: string;
|
|
317
|
-
order: number;
|
|
318
|
-
updatedAt: number;
|
|
319
|
-
} // --- 成员相关 (SpaceMember, SpaceMemberWithSpaceInfo 保持不变) ---
|
|
320
|
-
|
|
321
|
-
export interface SpaceMember {
|
|
322
|
-
role: MemberRole;
|
|
323
|
-
joinedAt: number;
|
|
324
|
-
updatedAt?: number;
|
|
325
|
-
userId: string;
|
|
326
|
-
spaceId: string;
|
|
327
|
-
} // Contents 类型保持不变 (Record<string, SpaceContent | null>)
|
|
328
|
-
export type Contents = Record<string, SpaceContent | null>;
|
|
329
|
-
export interface SpaceMemberWithSpaceInfo {
|
|
330
|
-
role: MemberRole;
|
|
331
|
-
joinedAt: number;
|
|
332
|
-
memberUpdatedAt?: number;
|
|
333
|
-
spaceId: string;
|
|
334
|
-
spaceName: string;
|
|
335
|
-
ownerId: string;
|
|
336
|
-
visibility: SpaceVisibility;
|
|
337
|
-
spaceCreatedAt: number;
|
|
338
|
-
spaceUpdatedAt: number;
|
|
339
|
-
type?: DataType;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
type MessageContentPartText = { type: "text"; text: string };
|
|
343
|
-
type MessageContentPartImageUrl = OpenAIImageContent;
|
|
344
|
-
|
|
345
|
-
type MessageContentPart = MessageContentPartText | MessageContentPartImageUrl;
|
|
346
|
-
|
|
347
|
-
export interface Message {
|
|
348
|
-
id?: string;
|
|
349
|
-
role: "user" | "assistant" | "system" | "tool" | "developer";
|
|
350
|
-
content: string | MessageContentPart[];
|
|
351
|
-
name?: string;
|
|
352
|
-
tool_calls?: any;
|
|
353
|
-
tool_call_id?: string;
|
|
354
|
-
userId?: string;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Share types re-exported from share/types
|
|
358
|
-
export type { ShareType, SharedObject, ShareMeta, ShareSummary } from "../share/types";
|
package/build.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { buildPublishArtifact } from "./buildPublish";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
|
|
7
|
-
const CLI_DIR = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const DIST_DIR = join(CLI_DIR, "dist");
|
|
9
|
-
|
|
10
|
-
console.log("Building publish artifact...");
|
|
11
|
-
console.log("Source:", CLI_DIR);
|
|
12
|
-
console.log("Dist:", DIST_DIR);
|
|
13
|
-
|
|
14
|
-
await buildPublishArtifact(CLI_DIR, DIST_DIR);
|
|
15
|
-
|
|
16
|
-
console.log("Build complete! Artifact at:", DIST_DIR);
|
package/buildPublish.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
buildPublishArtifactAssembly,
|
|
5
|
-
inlineWorkspaceDependencies,
|
|
6
|
-
} from "./buildPublishArtifactAssembly";
|
|
7
|
-
import {
|
|
8
|
-
collectTypeScriptSourceFiles,
|
|
9
|
-
collectWorkspaceDependencies,
|
|
10
|
-
extractExternalImports,
|
|
11
|
-
rewriteCrossPackageImports,
|
|
12
|
-
} from "./buildPublishImportAnalysis";
|
|
13
|
-
import { buildPublishManifest } from "./publishPackage";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Build a publish-safe CLI artifact in the dist directory.
|
|
17
|
-
*
|
|
18
|
-
* This function:
|
|
19
|
-
* 1. Creates a dist directory
|
|
20
|
-
* 2. Copies source files specified in package.json "files" array
|
|
21
|
-
* 3. Generates a publish-safe package.json (no workspace deps)
|
|
22
|
-
* 4. Inlines workspace dependencies from monorepo packages
|
|
23
|
-
*
|
|
24
|
-
* The output can be published to npm and installed outside the monorepo.
|
|
25
|
-
*
|
|
26
|
-
* @param sourceDir - The CLI package source directory (packages/cli)
|
|
27
|
-
* @param distDir - The output directory (packages/cli/dist)
|
|
28
|
-
*/
|
|
29
|
-
export async function buildPublishArtifact(
|
|
30
|
-
sourceDir: string,
|
|
31
|
-
distDir: string
|
|
32
|
-
): Promise<void> {
|
|
33
|
-
const pkgPath = join(sourceDir, "package.json");
|
|
34
|
-
if (!existsSync(pkgPath)) {
|
|
35
|
-
throw new Error(`package.json not found at ${pkgPath}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const sourceManifest = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
39
|
-
const filesToCopy = sourceManifest.files || [];
|
|
40
|
-
const warn = (message: string, error?: unknown): void => {
|
|
41
|
-
if (error === undefined) {
|
|
42
|
-
console.warn(message);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
console.warn(message, error);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const {
|
|
49
|
-
resolvedFilesToCopy,
|
|
50
|
-
inlinedDeps,
|
|
51
|
-
inlinedFiles = [],
|
|
52
|
-
externalDeps,
|
|
53
|
-
} = await buildPublishArtifactAssembly({
|
|
54
|
-
sourceDir,
|
|
55
|
-
distDir,
|
|
56
|
-
filesToCopy,
|
|
57
|
-
extractExternalImports,
|
|
58
|
-
rewriteCrossPackageImports,
|
|
59
|
-
collectWorkspaceDependencies: (entrySourceDir, resolvedFiles) =>
|
|
60
|
-
collectWorkspaceDependencies(entrySourceDir, sourceManifest, resolvedFiles),
|
|
61
|
-
inlineWorkspaceDependencies,
|
|
62
|
-
warn,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const publishManifest = buildPublishManifest(sourceManifest);
|
|
66
|
-
const repoRoot = join(sourceDir, "..", "..");
|
|
67
|
-
const rootManifest = existsSync(join(repoRoot, "package.json"))
|
|
68
|
-
? JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf8"))
|
|
69
|
-
: {};
|
|
70
|
-
const cliExternalDeps = discoverExternalImportsFromCliSourceFiles(
|
|
71
|
-
sourceDir,
|
|
72
|
-
resolvedFilesToCopy,
|
|
73
|
-
rootManifest
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
if (inlinedFiles.length > 0) {
|
|
77
|
-
publishManifest.files = Array.from(new Set([...resolvedFilesToCopy, ...inlinedFiles]));
|
|
78
|
-
} else if (inlinedDeps.length > 0) {
|
|
79
|
-
publishManifest.files = Array.from(new Set(resolvedFilesToCopy));
|
|
80
|
-
for (const dep of inlinedDeps) {
|
|
81
|
-
publishManifest.files.push(`${dep}/**/*.ts`);
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
publishManifest.files = Array.from(new Set(resolvedFilesToCopy));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (Object.keys(externalDeps).length > 0) {
|
|
88
|
-
publishManifest.dependencies = publishManifest.dependencies || {};
|
|
89
|
-
for (const [name, version] of Object.entries(externalDeps)) {
|
|
90
|
-
if (!publishManifest.dependencies[name]) {
|
|
91
|
-
publishManifest.dependencies[name] = version;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (Object.keys(cliExternalDeps).length > 0) {
|
|
97
|
-
publishManifest.dependencies = publishManifest.dependencies || {};
|
|
98
|
-
for (const [name, version] of Object.entries(cliExternalDeps)) {
|
|
99
|
-
if (!publishManifest.dependencies[name]) {
|
|
100
|
-
publishManifest.dependencies[name] = version;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
writeFileSync(
|
|
106
|
-
join(distDir, "package.json"),
|
|
107
|
-
JSON.stringify(publishManifest, null, 2) + "\n"
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function discoverExternalImportsFromCliSourceFiles(
|
|
112
|
-
sourceDir: string,
|
|
113
|
-
filesToCopy: string[],
|
|
114
|
-
rootManifest: Record<string, any>
|
|
115
|
-
): Record<string, string> {
|
|
116
|
-
const rootDeps: Record<string, string> = {};
|
|
117
|
-
if (rootManifest.dependencies) {
|
|
118
|
-
for (const [name, version] of Object.entries(rootManifest.dependencies)) {
|
|
119
|
-
if (typeof version === "string" && !version.startsWith("workspace:")) {
|
|
120
|
-
rootDeps[name] = version;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const externalDeps: Record<string, string> = {};
|
|
126
|
-
for (const filePath of collectTypeScriptSourceFiles(sourceDir, filesToCopy)) {
|
|
127
|
-
const content = readFileSync(filePath, "utf8");
|
|
128
|
-
for (const importName of extractExternalImports(content)) {
|
|
129
|
-
if (rootDeps[importName]) {
|
|
130
|
-
externalDeps[importName] = rootDeps[importName];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return externalDeps;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { rewriteCrossPackageImports } from "./buildPublishImportAnalysis";
|