@zq-silk/yui 0.15.8 → 0.15.9
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/ARCHITECTURE.md +2 -0
- package/ARCHITECTURE.zh-CN.md +151 -0
- package/README.md +211 -14
- package/dist/artifacts/artifactCapability.js +74 -0
- package/dist/artifacts/artifactCommitLock.js +249 -0
- package/dist/artifacts/artifactPaths.js +151 -0
- package/dist/artifacts/gitArtifactRef.js +146 -0
- package/dist/artifacts/managedGit.js +332 -0
- package/dist/artifacts/taskArtifactRepository.js +277 -0
- package/dist/cli/commandCatalog.js +14 -10
- package/dist/cli.js +67 -0
- package/dist/commands/operatorCommands.js +33 -2
- package/dist/commands/taskActivationCommands.js +22 -0
- package/dist/commands/taskCommands.js +342 -79
- package/dist/context/runContextPack.js +28 -16
- package/dist/context/taskContext.js +26 -3
- package/dist/controller/controller.js +8 -2
- package/dist/kernel/builtinCapabilities.js +32 -24
- package/dist/message/message.js +56 -0
- package/dist/plugins/pluginService.js +11 -3
- package/dist/resources/projectResource.js +0 -48
- package/dist/resources/projectResourceService.js +3 -81
- package/dist/setup/setupCommand.js +3 -8
- package/dist/storage/migrations/artifactsToGit.js +338 -0
- package/dist/storage/migrations/submitIntent.js +126 -0
- package/dist/storage/sqliteSchema.js +37 -3
- package/dist/storage/sqliteStore.js +1 -21
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +1 -1
- package/dist/task/taskActivation.js +26 -0
- package/dist/task/taskActivationService.js +85 -69
- package/dist/task/taskSubmission.js +236 -0
- package/dist/web/assets/client/app.js +3 -2
- package/dist/web/assets/client/taskSurface.js +96 -7
- package/dist/web/webServer.js +18 -3
- package/dist/web/webTaskSurface.js +6 -6
- package/dist/workItem/workItem.js +14 -10
- package/docs/agent-result-consumption.md +2 -0
- package/docs/agent-result-consumption.zh-CN.md +81 -0
- package/docs/agent-runtime-drivers.md +2 -0
- package/docs/agent-runtime-drivers.zh-CN.md +77 -0
- package/docs/architecture/README.md +44 -32
- package/docs/architecture/README.zh-CN.md +43 -0
- package/docs/architecture/capabilities-and-resources.md +118 -79
- package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
- package/docs/managed-turn-and-session-runtime.md +2 -0
- package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
- package/docs/observability/README.md +2 -0
- package/docs/observability/README.zh-CN.md +71 -0
- package/docs/plugin-sdk.md +320 -217
- package/docs/plugin-sdk.zh-CN.md +293 -0
- package/docs/provider-runtime.md +2 -0
- package/docs/provider-runtime.zh-CN.md +132 -0
- package/docs/release-workflow.md +2 -0
- package/docs/release-workflow.zh-CN.md +237 -0
- package/docs/roles-and-configuration.md +2 -0
- package/docs/roles-and-configuration.zh-CN.md +96 -0
- package/docs/sqlite-control-plane-design.md +2 -0
- package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
- package/docs/task-dag-semantics.md +80 -57
- package/docs/task-dag-semantics.zh-CN.md +59 -0
- package/docs/task-delivery.md +2 -0
- package/docs/task-delivery.zh-CN.md +82 -0
- package/docs/task-local-identity.md +2 -0
- package/docs/task-local-identity.zh-CN.md +58 -0
- package/docs/testing/verification-levels.md +2 -0
- package/docs/testing/verification-levels.zh-CN.md +69 -0
- package/i18n/README.zh-CN.md +199 -10
- package/package.json +2 -1
- package/skills/yui-leader/SKILL.md +88 -331
- package/skills/yui-leader/references/execution.md +303 -0
- package/skills/yui-leader/references/planning.md +109 -0
- package/skills/yui-leader/references/task-plugins.md +8 -4
- package/skills/yui-operator/SKILL.md +16 -3
package/dist/cli.js
CHANGED
|
@@ -46,6 +46,7 @@ import { runTaskPublicationVerifyCommand } from "./commands/taskPublicationVerif
|
|
|
46
46
|
import { createGitHubCliPublicationVerifier } from "./external/githubPublicationVerifier.js";
|
|
47
47
|
import { createGitLabCliPublicationVerifier } from "./external/gitlabPublicationVerifier.js";
|
|
48
48
|
import { taskLocalActor, assertTaskDeliveryAuthority } from "./commands/taskActor.js";
|
|
49
|
+
import { saveArtifactCapability, readArtifactCapability, listArtifactsCapability } from "./artifacts/artifactCapability.js";
|
|
49
50
|
import { parseTaskExecutionStartRequest, parseTaskExecutionStopRequest, finalizeStoppedTaskExecution, startTaskExecutionCommand, stopTaskExecutionCommand } from "./commands/taskExecutionCommands.js";
|
|
50
51
|
import { runTaskIntegrationCommand } from "./commands/taskIntegrationCommands.js";
|
|
51
52
|
import { runTaskChangeSetCommand } from "./commands/taskChangeSetCommands.js";
|
|
@@ -773,6 +774,72 @@ export async function main() {
|
|
|
773
774
|
return;
|
|
774
775
|
}
|
|
775
776
|
if (resolved[0] === "task") {
|
|
777
|
+
if (resolved[1] === "artifact") {
|
|
778
|
+
// File/directory artifacts live in the Task's local Git repository, so
|
|
779
|
+
// their save/read/list are asynchronous and handled here rather than in
|
|
780
|
+
// the synchronous runTaskCommand chain. Save commits exactly one path and
|
|
781
|
+
// returns a self-certifying commit-pinned reference; read pins to a commit
|
|
782
|
+
// for frozen evidence; list is an ordinary current read.
|
|
783
|
+
const action = resolved[2];
|
|
784
|
+
const taskId = resolved[3];
|
|
785
|
+
const usage = "Usage: yui task artifact list <task> | read <task> <relative-path> [<commit>] | "
|
|
786
|
+
+ "save <task> <relative-path> <content> [--message <text>] [--expected-head <commit>]";
|
|
787
|
+
if (taskId === undefined || action === undefined || !["list", "read", "save"].includes(action)) {
|
|
788
|
+
throw usageError(usage);
|
|
789
|
+
}
|
|
790
|
+
if (process.env.YUI_SESSION_SCOPE === "task" && process.env.YUI_TASK_ID !== taskId) {
|
|
791
|
+
throw usageError("Artifact is outside the managed Task scope.");
|
|
792
|
+
}
|
|
793
|
+
if (store.getTask(taskId) === null)
|
|
794
|
+
throw usageError(`Task not found: ${taskId}.`);
|
|
795
|
+
let data;
|
|
796
|
+
if (action === "list") {
|
|
797
|
+
if (resolved.length !== 4)
|
|
798
|
+
throw usageError(usage);
|
|
799
|
+
data = await listArtifactsCapability(home, taskId);
|
|
800
|
+
}
|
|
801
|
+
else if (action === "read") {
|
|
802
|
+
const relativePath = resolved[4];
|
|
803
|
+
const commit = resolved[5];
|
|
804
|
+
if (relativePath === undefined || resolved.length > 6)
|
|
805
|
+
throw usageError(usage);
|
|
806
|
+
data = await readArtifactCapability(home, taskId, {
|
|
807
|
+
relativePath, ...(commit === undefined ? {} : { commit })
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
// save: a delivery-authoritative action; a managed Task caller must be the current Leader.
|
|
812
|
+
taskLocalActor(store, process.env, taskId);
|
|
813
|
+
const relativePath = resolved[4];
|
|
814
|
+
const content = resolved[5];
|
|
815
|
+
if (relativePath === undefined || content === undefined)
|
|
816
|
+
throw usageError(usage);
|
|
817
|
+
const rest = resolved.slice(6);
|
|
818
|
+
let message;
|
|
819
|
+
let expectedHead;
|
|
820
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
821
|
+
const value = rest[index + 1];
|
|
822
|
+
if (rest[index] === "--message" && value !== undefined) {
|
|
823
|
+
message = value;
|
|
824
|
+
index += 1;
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
if (rest[index] === "--expected-head" && value !== undefined) {
|
|
828
|
+
expectedHead = value;
|
|
829
|
+
index += 1;
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
throw usageError(usage);
|
|
833
|
+
}
|
|
834
|
+
data = await saveArtifactCapability(home, taskId, {
|
|
835
|
+
relativePath, content,
|
|
836
|
+
...(message === undefined ? {} : { message }),
|
|
837
|
+
...(expectedHead === undefined ? {} : { expectedHead })
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
emit(JSON.stringify(data, null, 2), false, data);
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
776
843
|
if (resolved[1] === "execution") {
|
|
777
844
|
if (resolved[2] === "stop") {
|
|
778
845
|
const request = parseTaskExecutionStopRequest(resolved.slice(3));
|
|
@@ -5,6 +5,7 @@ import { listOperatorSessions, projectOperatorStatus, prepareOperatorNewSession,
|
|
|
5
5
|
import { defaultTableWidth, renderTable } from "../output/table.js";
|
|
6
6
|
import { formatRelativeTimestamp } from "../output/timePresentation.js";
|
|
7
7
|
import { updateGlobalRole } from "../role/role.js";
|
|
8
|
+
import { TASK_SUBMISSION_INTENTS } from "../message/message.js";
|
|
8
9
|
import { submitOperatorMessage } from "./taskCommands.js";
|
|
9
10
|
import { readCommandText } from "./textInput.js";
|
|
10
11
|
/** Operator command parsing never launches or attaches a native process. */
|
|
@@ -63,10 +64,12 @@ function status(args, store, options) {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
function submit(rest, store, options) {
|
|
66
|
-
const usage = "Operator submit usage: yui operator submit (<body>|--body-file <path|->) [--task <id>].";
|
|
67
|
+
const usage = "Operator submit usage: yui operator submit (<body>|--body-file <path|->) [--task <id>] [--intent record|discuss|develop] [--request-id <key>].";
|
|
67
68
|
const positionals = [];
|
|
68
69
|
let taskId;
|
|
69
70
|
let bodyFile;
|
|
71
|
+
let intentRaw;
|
|
72
|
+
let requestId;
|
|
70
73
|
for (let index = 0; index < rest.length; index += 1) {
|
|
71
74
|
const value = rest[index];
|
|
72
75
|
if (value === "--body-file") {
|
|
@@ -79,6 +82,26 @@ function submit(rest, store, options) {
|
|
|
79
82
|
index += 1;
|
|
80
83
|
continue;
|
|
81
84
|
}
|
|
85
|
+
if (value === "--intent") {
|
|
86
|
+
if (intentRaw !== undefined)
|
|
87
|
+
throw usageError("Option may only be specified once: --intent.", usage);
|
|
88
|
+
const candidate = rest[index + 1];
|
|
89
|
+
if (candidate === undefined || candidate.startsWith("--"))
|
|
90
|
+
throw usageError("--intent is required.", usage);
|
|
91
|
+
intentRaw = candidate.trim();
|
|
92
|
+
index += 1;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (value === "--request-id") {
|
|
96
|
+
if (requestId !== undefined)
|
|
97
|
+
throw usageError("Option may only be specified once: --request-id.", usage);
|
|
98
|
+
const candidate = rest[index + 1];
|
|
99
|
+
if (candidate === undefined || candidate.startsWith("--"))
|
|
100
|
+
throw usageError("--request-id is required.", usage);
|
|
101
|
+
requestId = candidate.trim();
|
|
102
|
+
index += 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
82
105
|
if (value !== "--task") {
|
|
83
106
|
if (value.startsWith("--"))
|
|
84
107
|
throw usageError(`Unsupported option: ${value}.`, usage);
|
|
@@ -96,10 +119,18 @@ function submit(rest, store, options) {
|
|
|
96
119
|
}
|
|
97
120
|
if (positionals.length > 1)
|
|
98
121
|
throw usageError(usage);
|
|
122
|
+
const intent = intentRaw === undefined
|
|
123
|
+
? undefined
|
|
124
|
+
: TASK_SUBMISSION_INTENTS.includes(intentRaw)
|
|
125
|
+
? intentRaw
|
|
126
|
+
: (() => { throw usageError(`--intent must be one of ${TASK_SUBMISSION_INTENTS.join(", ")}: ${intentRaw}.`, usage); })();
|
|
127
|
+
if (requestId !== undefined && requestId.length === 0) {
|
|
128
|
+
throw usageError("--request-id is required.", usage);
|
|
129
|
+
}
|
|
99
130
|
const body = readCommandText(positionals[0], bodyFile, "--body", usage);
|
|
100
131
|
return {
|
|
101
132
|
kind: "output",
|
|
102
|
-
output: submitOperatorMessage(body, taskId, store, options)
|
|
133
|
+
output: submitOperatorMessage(body, taskId, store, options, intent, requestId)
|
|
103
134
|
};
|
|
104
135
|
}
|
|
105
136
|
function listSessions(args, store, options) {
|
|
@@ -52,6 +52,10 @@ function requestActivation(args, store, options) {
|
|
|
52
52
|
actorId: caller.actorId,
|
|
53
53
|
authorityRef: caller.authorityRef,
|
|
54
54
|
environmentPlan,
|
|
55
|
+
// The activation-request command is the explicit activation boundary, so
|
|
56
|
+
// every request it records carries an explicit provable origin (task-32
|
|
57
|
+
// §2.4). A develop submission records its own request with `submit-develop`.
|
|
58
|
+
origin: "explicit",
|
|
55
59
|
...(caller.planningRunId === undefined ? {} : { callerRunId: caller.planningRunId })
|
|
56
60
|
}, now));
|
|
57
61
|
// An immediate request has nothing left to wait for, so ask the Controller to
|
|
@@ -173,6 +177,24 @@ function activationCaller(store, options, taskId) {
|
|
|
173
177
|
: {})
|
|
174
178
|
};
|
|
175
179
|
}
|
|
180
|
+
if (actor === "operator") {
|
|
181
|
+
return nonLeaderActivationIdentity(store, "operator");
|
|
182
|
+
}
|
|
183
|
+
return nonLeaderActivationIdentity(store, "user");
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The activation actor/authority identity for a user or Operator submission.
|
|
187
|
+
*
|
|
188
|
+
* A develop submission (task-32 §2.4) records its own activation request inside
|
|
189
|
+
* the message-save transaction, and it must stamp the exact same identity the
|
|
190
|
+
* explicit `yui task activation request` boundary would for the same caller —
|
|
191
|
+
* otherwise the Controller and the workspace preparer could treat "the user
|
|
192
|
+
* asked via submit" differently from "the user asked via activate". Sharing this
|
|
193
|
+
* mapping is what keeps the two entry points one activation contract rather than
|
|
194
|
+
* two. Leader identity is deliberately excluded: it binds to a live native
|
|
195
|
+
* Session and is resolved only by {@link activationCaller}.
|
|
196
|
+
*/
|
|
197
|
+
export function nonLeaderActivationIdentity(store, actor) {
|
|
176
198
|
if (actor === "operator") {
|
|
177
199
|
return {
|
|
178
200
|
actorId: "global:operator",
|