@zq-silk/yui 2.1.0 → 2.3.0

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.
Files changed (135) hide show
  1. package/README.md +8 -2
  2. package/dist/cli/commandCatalog.js +32 -6
  3. package/dist/cli/commandDiscovery.js +4 -1
  4. package/dist/cli/interactionPolicy.js +4 -0
  5. package/dist/cli.js +23 -3078
  6. package/dist/commands/taskCommands.js +84 -28
  7. package/dist/commands/taskIntegrationCommands.js +8 -17
  8. package/dist/commands/taskUpstreamCommands.js +3 -1
  9. package/dist/context/runContextPack.js +132 -5
  10. package/dist/context/sourceRunContext.js +4 -2
  11. package/dist/context/taskContext.js +6 -1
  12. package/dist/controlPlaneCli.js +3099 -0
  13. package/dist/controller/clientRuntime.js +3 -2
  14. package/dist/controller/fileSchedulerStoreAdapter.js +19 -6
  15. package/dist/controller/jobControl.js +21 -0
  16. package/dist/executor/agentExecutor.js +1 -1
  17. package/dist/executor/effectiveLaunch.js +18 -5
  18. package/dist/executor/fileRoleLaunchPlanner.js +15 -19
  19. package/dist/integration/gitIntegrationService.js +58 -82
  20. package/dist/job/jobCleanupInspection.js +67 -0
  21. package/dist/message/messageContinuation.js +7 -2
  22. package/dist/nativeAgent/agent.js +176 -74
  23. package/dist/nativeAgent/cliDemo.js +37 -0
  24. package/dist/nativeAgent/codingTools.js +11 -0
  25. package/dist/nativeAgent/commandTool.js +215 -0
  26. package/dist/nativeAgent/compactionDemo.js +158 -0
  27. package/dist/nativeAgent/composition.js +71 -0
  28. package/dist/nativeAgent/context/budget.js +44 -0
  29. package/dist/nativeAgent/context/index.js +339 -0
  30. package/dist/nativeAgent/context/providerCompressor.js +103 -0
  31. package/dist/nativeAgent/demo.js +12 -1
  32. package/dist/nativeAgent/evaluation/cases.js +38 -0
  33. package/dist/nativeAgent/evaluation/checks.js +91 -0
  34. package/dist/nativeAgent/evaluation/demo.js +19 -0
  35. package/dist/nativeAgent/evaluation/files.js +54 -0
  36. package/dist/nativeAgent/evaluation/fixture.js +36 -0
  37. package/dist/nativeAgent/evaluation/index.js +239 -0
  38. package/dist/nativeAgent/executionOwner.js +209 -0
  39. package/dist/nativeAgent/filePatterns.js +170 -0
  40. package/dist/nativeAgent/fileToolsSupport.js +202 -0
  41. package/dist/nativeAgent/index.js +13 -0
  42. package/dist/nativeAgent/interaction/cli.js +358 -0
  43. package/dist/nativeAgent/interaction/contracts.js +1 -0
  44. package/dist/nativeAgent/interaction/index.js +3 -0
  45. package/dist/nativeAgent/interaction/memoryDemo.js +115 -0
  46. package/dist/nativeAgent/interaction/renderer.js +34 -0
  47. package/dist/nativeAgent/localSafety.js +258 -0
  48. package/dist/nativeAgent/model/anthropicMessages.js +204 -0
  49. package/dist/nativeAgent/model/chatCompletions.js +210 -0
  50. package/dist/nativeAgent/model/errors.js +47 -0
  51. package/dist/nativeAgent/model/gateway.js +423 -0
  52. package/dist/nativeAgent/model/index.js +7 -0
  53. package/dist/nativeAgent/model/observationAdapter.js +21 -0
  54. package/dist/nativeAgent/model/protocols.js +19 -0
  55. package/dist/nativeAgent/model/responses.js +263 -0
  56. package/dist/nativeAgent/model/types.js +1 -0
  57. package/dist/nativeAgent/model/wire.js +73 -0
  58. package/dist/nativeAgent/observability/index.js +220 -0
  59. package/dist/nativeAgent/product/catalog.js +82 -0
  60. package/dist/nativeAgent/product/config.js +295 -0
  61. package/dist/nativeAgent/product/facts.js +30 -0
  62. package/dist/nativeAgent/product/index.js +62 -0
  63. package/dist/nativeAgent/product/location.js +44 -0
  64. package/dist/nativeAgent/product/runtime.js +276 -0
  65. package/dist/nativeAgent/product/storage.js +49 -0
  66. package/dist/nativeAgent/product/tools.js +47 -0
  67. package/dist/nativeAgent/product/transport.js +54 -0
  68. package/dist/nativeAgent/projectGuidance/index.js +425 -0
  69. package/dist/nativeAgent/searchTools.js +305 -0
  70. package/dist/nativeAgent/session/backends.js +293 -0
  71. package/dist/nativeAgent/session/catalog.js +97 -0
  72. package/dist/nativeAgent/session/catalogDemo.js +87 -0
  73. package/dist/nativeAgent/session/contracts.js +1 -0
  74. package/dist/nativeAgent/session/format.js +269 -0
  75. package/dist/nativeAgent/session/index.js +5 -0
  76. package/dist/nativeAgent/session/location.js +36 -0
  77. package/dist/nativeAgent/session/sqliteFormat.js +134 -0
  78. package/dist/nativeAgent/session/store.js +248 -0
  79. package/dist/nativeAgent/textTools.js +270 -133
  80. package/dist/nativeAgent/toolManager/executor.js +290 -0
  81. package/dist/nativeAgent/toolManager/index.js +4 -0
  82. package/dist/nativeAgent/validation.js +2 -2
  83. package/dist/repository/gitWorkspace.js +41 -12
  84. package/dist/repository/taskWorkspaceCoordinator.js +72 -145
  85. package/dist/repository/taskWorkspacePreparer.js +39 -43
  86. package/dist/repository/workspaceCleanupInspection.js +88 -7
  87. package/dist/resources/resourceRegistrar.js +16 -10
  88. package/dist/runtime/integrationRuntimeIsolation.js +21 -0
  89. package/dist/runtime/taskRuntimeIsolation.js +91 -21
  90. package/dist/task/archiveDiagnostics.js +26 -8
  91. package/dist/task/archivePreflight.js +26 -9
  92. package/dist/task/leaderArchive.js +9 -15
  93. package/dist/task/taskAuthority.js +56 -0
  94. package/dist/web/assets/client/api.js +8 -0
  95. package/dist/web/assets/client/app.js +74 -9
  96. package/dist/web/assets/client/components.js +95 -36
  97. package/dist/web/assets/client/detail.js +110 -64
  98. package/dist/web/assets/client/dock.js +95 -11
  99. package/dist/web/assets/client/evidence.js +286 -94
  100. package/dist/web/assets/client/i18n.js +182 -62
  101. package/dist/web/assets/client/overview.js +9 -10
  102. package/dist/web/assets/client/records.js +142 -7
  103. package/dist/web/assets/client/sections.js +234 -198
  104. package/dist/web/assets/client/sidebar.js +31 -2
  105. package/dist/web/assets/icons.js +4 -0
  106. package/dist/web/assets/shell.js +2 -1
  107. package/dist/web/assets/styles/components.js +64 -15
  108. package/dist/web/assets/styles/layout.js +11 -4
  109. package/dist/web/assets/styles/responsive.js +16 -6
  110. package/dist/web/assets/styles/tokens.js +1 -1
  111. package/dist/web/assets/styles/views.js +62 -42
  112. package/dist/web/webServer.js +12 -1
  113. package/dist/web/webTaskSurface.js +8 -1
  114. package/docs/agent-result-consumption.md +16 -0
  115. package/docs/agent-result-consumption.zh-CN.md +13 -0
  116. package/docs/examples/agent-offline.mjs +194 -0
  117. package/docs/native-agent.md +283 -0
  118. package/docs/observability/README.md +13 -3
  119. package/docs/observability/README.zh-CN.md +10 -3
  120. package/docs/release-workflow.md +72 -9
  121. package/docs/release-workflow.zh-CN.md +55 -6
  122. package/docs/roles-and-configuration.md +32 -0
  123. package/docs/roles-and-configuration.zh-CN.md +26 -0
  124. package/docs/task-delivery.md +36 -8
  125. package/docs/task-delivery.zh-CN.md +24 -7
  126. package/i18n/README.zh-CN.md +3 -2
  127. package/package.json +1 -1
  128. package/skills/yui-leader/SKILL.md +9 -0
  129. package/skills/yui-leader/references/execution.md +2 -1
  130. package/skills/yui-leader/references/integration.md +20 -0
  131. package/skills/yui-operator/SKILL.md +4 -0
  132. package/skills/yui-reviewer/SKILL.md +8 -0
  133. package/skills/yui-runtime/SKILL.md +11 -0
  134. package/skills/yui-runtime/references/publication.md +20 -4
  135. package/skills/yui-worker/SKILL.md +3 -0
@@ -2,7 +2,7 @@ export const RECORDS_SCRIPT = String.raw `
2
2
  // Context record access. Every business fact keeps its Context reference; an
3
3
  // expanded value is a current read, never a mutation of the snapshot.
4
4
  import { h, icon } from "/assets/js/dom.js";
5
- import { richText, mono, button, note } from "/assets/js/components.js";
5
+ import { richText, mono, button, note, disclosure } from "/assets/js/components.js";
6
6
 
7
7
  export function entriesOf(core, store) {
8
8
  return core.records.filter(function (entry) { return entry.ref.store === store; });
@@ -12,6 +12,127 @@ export function valuesOf(core, store) {
12
12
  return entriesOf(core, store).filter(function (entry) { return !entry.omitted; }).map(function (entry) { return entry.value; });
13
13
  }
14
14
 
15
+ // The family total from the same bounded read as its samples. The current
16
+ // view counts current records only: open work, active runs, open questions.
17
+ export function totalOf(core, store) {
18
+ const row = (core.collections || []).find(function (item) { return item.store === store; });
19
+ return row ? row.total : entriesOf(core, store).length;
20
+ }
21
+
22
+ // List and omitted-value summaries join known fields in a fixed order
23
+ // ("title: …; status: …"). Split them for display only; the exact record
24
+ // stays one read away.
25
+ const SUMMARY_KEYS = ["title", "objective", "question", "summary", "body", "status", "type"];
26
+ export function summaryFields(summary) {
27
+ const fields = {};
28
+ if (!summary) return fields;
29
+ const pattern = new RegExp("(?:^|; )(" + SUMMARY_KEYS.join("|") + "): ", "g");
30
+ const marks = [];
31
+ let match;
32
+ while ((match = pattern.exec(summary))) {
33
+ const rank = SUMMARY_KEYS.indexOf(match[1]);
34
+ if (marks.length && rank <= marks[marks.length - 1].rank) continue;
35
+ marks.push({ key: match[1], rank: rank, start: match.index, from: match.index + match[0].length });
36
+ }
37
+ marks.forEach(function (mark, index) {
38
+ fields[mark.key] = summary.slice(mark.from, index + 1 < marks.length ? marks[index + 1].start : summary.length);
39
+ });
40
+ return fields;
41
+ }
42
+
43
+ // --- Exact reads -------------------------------------------------------------
44
+ // One inspect per reference digest, held in view state so a refresh with an
45
+ // unchanged reference never reads again. A changed digest is a new read.
46
+ export function readExact(entry, taskId, actions, cache) {
47
+ const key = entry.ref.store + "/" + entry.ref.refId;
48
+ const hit = cache[key];
49
+ if (hit && hit.digest === entry.ref.digest) return hit.promise;
50
+ const promise = actions.inspect(taskId, entry.ref);
51
+ const slot = { digest: entry.ref.digest, promise: promise, result: null };
52
+ cache[key] = slot;
53
+ promise.then(function (result) { slot.result = result; }, function () { if (cache[key] === slot) delete cache[key]; });
54
+ return promise;
55
+ }
56
+
57
+ // A row drawn from its exact value: synchronously when cached, otherwise the
58
+ // honest summary card until the read returns and replaces it in place.
59
+ export function exactRow(entry, taskId, t, actions, cache, render) {
60
+ if (!entry.omitted) return render(entry.value, null);
61
+ const hit = cache[entry.ref.store + "/" + entry.ref.refId];
62
+ if (hit && hit.digest === entry.ref.digest && hit.result) return render(hit.result.value, hit.result);
63
+ const placeholder = recordCard(entry, taskId, t, actions);
64
+ placeholder.dataset.reading = "true";
65
+ readExact(entry, taskId, actions, cache).then(function (result) {
66
+ if (placeholder.isConnected) placeholder.replaceWith(render(result.value, result));
67
+ }, function () { placeholder.dataset.reading = "false"; });
68
+ return placeholder;
69
+ }
70
+
71
+ // A closed row drawn from a list summary; its exact value is read on first
72
+ // open. Open rows are remembered in view state and reopen after a redraw.
73
+ export function lazyRow(item, taskId, t, actions, options) {
74
+ const opts = options || {};
75
+ const key = item.ref.store + ":" + item.ref.refId;
76
+ const element = h("details.lazy-row");
77
+ if (item.status) element.dataset.status = item.status;
78
+ const body = h("div.lazy-body");
79
+ element.append(h("summary.lazy-head", null, icon("chevron", "disclosure-chevron"), opts.head), body);
80
+ let state = "idle";
81
+ function load() {
82
+ if (state !== "idle") return;
83
+ state = "reading";
84
+ element.dataset.reading = "true";
85
+ body.replaceChildren(h("p.faint.small", null, t("record.reading")));
86
+ readExact({ ref: item.ref }, taskId, actions, opts.cache || {}).then(function (result) {
87
+ state = "done";
88
+ const raw = disclosure(t("record.raw"), null);
89
+ raw.body.append(h("pre.code-block", null, JSON.stringify(result.value, null, 2)));
90
+ body.replaceChildren();
91
+ body.append(h("div.lazy-content", null, opts.render ? opts.render(result.value, result) : null), raw);
92
+ }, function (error) {
93
+ state = "idle";
94
+ body.replaceChildren(note(t("record.changed") + " · " + error.message, "bad"));
95
+ }).then(function () { element.dataset.reading = "false"; });
96
+ }
97
+ element.addEventListener("toggle", function () {
98
+ if (opts.openRows) { if (element.open) opts.openRows[key] = true; else delete opts.openRows[key]; }
99
+ if (element.open) load();
100
+ });
101
+ if (opts.openRows && opts.openRows[key]) element.open = true;
102
+ return element;
103
+ }
104
+
105
+ // --- Paged family discovery --------------------------------------------------
106
+ // Pages of one Context family for the current Context cursor. A continuation
107
+ // never mixes versions: after the cursor changes, the first page is re-read.
108
+ export function familyState(view, store) {
109
+ view.families = view.families || {};
110
+ if (!view.families[store]) view.families[store] = { items: [], total: null, nextCursor: null, pages: 0, key: null, error: null, pending: null };
111
+ return view.families[store];
112
+ }
113
+
114
+ export function loadFamily(view, taskId, store, key, actions, options) {
115
+ const state = familyState(view, store);
116
+ const more = !!(options && options.more);
117
+ if (state.pending) return state.pending;
118
+ if (more ? !state.nextCursor : state.key === key && state.pages && !state.error) return Promise.resolve(state);
119
+ state.pending = actions.list(taskId, store, { limit: (options && options.limit) || 40, cursor: more ? state.nextCursor : null })
120
+ .then(function (page) {
121
+ if (!more) { state.items = []; state.pages = 0; }
122
+ state.items = state.items.concat(page.items);
123
+ state.total = page.total;
124
+ state.nextCursor = page.nextCursor;
125
+ state.pages += 1;
126
+ state.key = more ? state.key : key;
127
+ state.error = null;
128
+ state.errorKey = null;
129
+ return state;
130
+ }, function (error) { state.error = error.message; state.errorKey = more ? state.key : key; return state; })
131
+ .then(function (result) { state.pending = null; return result; });
132
+ return state.pending;
133
+ }
134
+
135
+ // --- Cards ---------------------------------------------------------------------
15
136
  // A generic, honest card for any record: omitted values say so and can be
16
137
  // read by reference; reading never acknowledges or accepts anything.
17
138
  export function recordCard(entry, taskId, t, actions, options) {
@@ -31,7 +152,12 @@ export function recordCard(entry, taskId, t, actions, options) {
31
152
  if (facts.length) element.append(h("p.faint.small", null, facts.join(" · ")));
32
153
  if (entry.ref.store === "job") element.append(note(t("job." + value.status + ".note", t("job.terminal.note")), value.status === "unknown-needs-attention" ? "warn" : ""));
33
154
  } else {
34
- element.append(h("p.faint", null, entry.summary || t("record.omitted")));
155
+ const fields = summaryFields(entry.summary);
156
+ const lead = fields.title || fields.question || fields.objective;
157
+ if (lead) element.append(h("p.record-lead", null, lead));
158
+ const text = fields.summary || fields.body || (lead === fields.objective ? null : fields.objective);
159
+ if (text) element.append(h("p.faint", null, text));
160
+ if (!lead && !text) element.append(h("p.faint", null, entry.summary || t("record.omitted")));
35
161
  }
36
162
  element.append(recordReader(entry, taskId, t, actions));
37
163
  return element;
@@ -39,7 +165,9 @@ export function recordCard(entry, taskId, t, actions, options) {
39
165
 
40
166
  // Shared source access for cards, history and discussion, including records
41
167
  // whose compact value is present but does not display every durable field.
42
- export function recordReader(entry, taskId, t, actions) {
168
+ // With a renderer, the exact value is drawn richly and the raw record stays
169
+ // available behind a disclosure.
170
+ export function recordReader(entry, taskId, t, actions, render) {
43
171
  const element = h("div.stack");
44
172
  const expand = button(t("record.read"), { icon: "eye", variant: "link" });
45
173
  expand.addEventListener("click", async function () {
@@ -47,10 +175,17 @@ export function recordReader(entry, taskId, t, actions) {
47
175
  element.dataset.reading = "true";
48
176
  try {
49
177
  const result = await actions.inspect(taskId, entry.ref);
50
- if (result.result && result.result.output) element.append(richText(t("record.output"), result.result.output, t));
51
- if (result.result && result.result.diagnostic) element.append(richText(t("record.diagnostic"), result.result.diagnostic, t));
52
- element.append(h("pre.code-block", null, JSON.stringify(result.value, null, 2)));
53
- if (result.execution) element.append(h("pre.code-block", null, JSON.stringify(result.execution, null, 2)));
178
+ const rich = render ? render(result.value, result) : null;
179
+ if (rich) {
180
+ const raw = disclosure(t("record.raw"), null);
181
+ raw.body.append(h("pre.code-block", null, JSON.stringify(result.value, null, 2)));
182
+ element.append(rich, raw);
183
+ } else {
184
+ if (result.result && result.result.output) element.append(richText(t("record.output"), result.result.output, t));
185
+ if (result.result && result.result.diagnostic) element.append(richText(t("record.diagnostic"), result.result.diagnostic, t));
186
+ element.append(h("pre.code-block", null, JSON.stringify(result.value, null, 2)));
187
+ if (result.execution) element.append(h("pre.code-block", null, JSON.stringify(result.execution, null, 2)));
188
+ }
54
189
  expand.remove();
55
190
  } catch {
56
191
  expand.disabled = false;