dsh-super-code 0.0.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.
Files changed (71) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +162 -0
  3. package/client/index.js +920 -0
  4. package/cordis.patch.yml +21 -0
  5. package/lib/core/delegation.d.ts +59 -0
  6. package/lib/core/delegation.d.ts.map +1 -0
  7. package/lib/core/delegation.js +41 -0
  8. package/lib/core/delegation.js.map +1 -0
  9. package/lib/core/evaluation.d.ts +123 -0
  10. package/lib/core/evaluation.d.ts.map +1 -0
  11. package/lib/core/evaluation.js +180 -0
  12. package/lib/core/evaluation.js.map +1 -0
  13. package/lib/core/experiment-recipes.d.ts +5 -0
  14. package/lib/core/experiment-recipes.d.ts.map +1 -0
  15. package/lib/core/experiment-recipes.js +67 -0
  16. package/lib/core/experiment-recipes.js.map +1 -0
  17. package/lib/core/guidance.d.ts +10 -0
  18. package/lib/core/guidance.d.ts.map +1 -0
  19. package/lib/core/guidance.js +16 -0
  20. package/lib/core/guidance.js.map +1 -0
  21. package/lib/core/session-scan.d.ts +8 -0
  22. package/lib/core/session-scan.d.ts.map +1 -0
  23. package/lib/core/session-scan.js +21 -0
  24. package/lib/core/session-scan.js.map +1 -0
  25. package/lib/core/task-memory.d.ts +81 -0
  26. package/lib/core/task-memory.d.ts.map +1 -0
  27. package/lib/core/task-memory.js +158 -0
  28. package/lib/core/task-memory.js.map +1 -0
  29. package/lib/core/teams.d.ts +19 -0
  30. package/lib/core/teams.d.ts.map +1 -0
  31. package/lib/core/teams.js +40 -0
  32. package/lib/core/teams.js.map +1 -0
  33. package/lib/core/tool-evidence.d.ts +57 -0
  34. package/lib/core/tool-evidence.d.ts.map +1 -0
  35. package/lib/core/tool-evidence.js +97 -0
  36. package/lib/core/tool-evidence.js.map +1 -0
  37. package/lib/dsh/index.d.ts +6 -0
  38. package/lib/dsh/index.d.ts.map +1 -0
  39. package/lib/dsh/index.js +11 -0
  40. package/lib/dsh/index.js.map +1 -0
  41. package/lib/dsh/super-code.d.ts +22 -0
  42. package/lib/dsh/super-code.d.ts.map +1 -0
  43. package/lib/dsh/super-code.js +247 -0
  44. package/lib/dsh/super-code.js.map +1 -0
  45. package/lib/evaluate.d.ts +3 -0
  46. package/lib/evaluate.d.ts.map +1 -0
  47. package/lib/evaluate.js +40 -0
  48. package/lib/evaluate.js.map +1 -0
  49. package/lib/experiments.d.ts +77 -0
  50. package/lib/experiments.d.ts.map +1 -0
  51. package/lib/experiments.js +196 -0
  52. package/lib/experiments.js.map +1 -0
  53. package/lib/index.d.ts +13 -0
  54. package/lib/index.d.ts.map +1 -0
  55. package/lib/index.js +14 -0
  56. package/lib/index.js.map +1 -0
  57. package/lib/super-agent-usage.d.ts +44 -0
  58. package/lib/super-agent-usage.d.ts.map +1 -0
  59. package/lib/super-agent-usage.js +203 -0
  60. package/lib/super-agent-usage.js.map +1 -0
  61. package/lib/task-memory-projection.d.ts +43 -0
  62. package/lib/task-memory-projection.d.ts.map +1 -0
  63. package/lib/task-memory-projection.js +48 -0
  64. package/lib/task-memory-projection.js.map +1 -0
  65. package/lib/task-memory-store.d.ts +35 -0
  66. package/lib/task-memory-store.d.ts.map +1 -0
  67. package/lib/task-memory-store.js +69 -0
  68. package/lib/task-memory-store.js.map +1 -0
  69. package/package.json +123 -0
  70. package/presets/super-code/agent.cordis.yml +50 -0
  71. package/presets/super-code/preset.yml +3 -0
@@ -0,0 +1,21 @@
1
+ import { setImmediate } from 'node:timers/promises';
2
+ /** Bounded backward lookup; yield between chunks so cancellation stays responsive. */
3
+ export async function scanSessionPage(end, before, eventAt, visit, signal) {
4
+ if (!Number.isSafeInteger(before) || before < 0 || before > end)
5
+ throw new Error('eventSeq must be an exclusive cursor between 0 and the session end');
6
+ let cursor = before, scanned = 0;
7
+ signal.throwIfAborted();
8
+ while (cursor > 0 && scanned < 4096) {
9
+ if (scanned > 0 && scanned % 256 === 0) {
10
+ await setImmediate(undefined, { signal });
11
+ signal.throwIfAborted();
12
+ }
13
+ const event = eventAt(--cursor);
14
+ scanned++;
15
+ if (event !== undefined && visit(event))
16
+ break;
17
+ }
18
+ signal.throwIfAborted();
19
+ return { nextBeforeSeq: cursor, done: cursor === 0, scanned };
20
+ }
21
+ //# sourceMappingURL=session-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-scan.js","sourceRoot":"","sources":["../../src/core/session-scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,MAAc,EAAE,OAAkD,EACnH,KAAuC,EAAE,MAAmB;IAC5D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;IACtJ,IAAI,MAAM,GAAG,MAAM,EAAE,OAAO,GAAG,CAAC,CAAA;IAChC,MAAM,CAAC,cAAc,EAAE,CAAA;IACvB,OAAO,MAAM,GAAG,CAAC,IAAI,OAAO,GAAG,IAAI,EAAE,CAAC;QACpC,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;YACvC,MAAM,YAAY,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;YACzC,MAAM,CAAC,cAAc,EAAE,CAAA;QACzB,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;QAC/B,OAAO,EAAE,CAAA;QACT,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC;YAAE,MAAK;IAChD,CAAC;IACD,MAAM,CAAC,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;AAC/D,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ import type { TeamName, WorkDepth } from './teams.js';
3
+ export interface TaskSource {
4
+ seq: number;
5
+ quote: string;
6
+ }
7
+ export interface Requirement {
8
+ id: string;
9
+ text: string;
10
+ source: TaskSource;
11
+ }
12
+ export interface TaskEvidence {
13
+ summary: string;
14
+ ref: string;
15
+ sourceVersion: string;
16
+ requirementsRevision: number;
17
+ kind: 'observed' | 'assumption' | 'test' | 'decision';
18
+ }
19
+ export interface TaskMemory {
20
+ id: string;
21
+ title: string;
22
+ team: TeamName;
23
+ depth: WorkDepth;
24
+ workspace: string;
25
+ sourceVersion: string;
26
+ goal: string;
27
+ createdAtSeq: number;
28
+ source: TaskSource;
29
+ requirements: Requirement[];
30
+ acceptance: string[];
31
+ decisions: string[];
32
+ evidence: TaskEvidence[];
33
+ next: string;
34
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
35
+ revision: number;
36
+ requirementsRevision: number;
37
+ delegationRevision: number;
38
+ }
39
+ export interface TaskMemoryState {
40
+ tasks: Record<string, TaskMemory>;
41
+ recentSources: number[];
42
+ focus: {
43
+ kind: 'none';
44
+ } | {
45
+ kind: 'task';
46
+ id: string;
47
+ };
48
+ }
49
+ export type TaskMemoryEvent = {
50
+ kind: 'save';
51
+ task: TaskMemory;
52
+ } | {
53
+ kind: 'focus';
54
+ id: string;
55
+ } | {
56
+ kind: 'archive';
57
+ task: TaskMemory;
58
+ };
59
+ export type TaskMemoryCreate = Omit<TaskMemory, 'createdAtSeq' | 'revision' | 'requirementsRevision' | 'delegationRevision' | 'status' | 'evidence' | 'decisions' | 'next'>;
60
+ export type TaskMemoryPatch = Partial<Omit<TaskMemory, 'id' | 'createdAtSeq' | 'revision' | 'requirementsRevision' | 'delegationRevision'>> & {
61
+ removeRequirements?: string[];
62
+ };
63
+ export declare const sourceSchema: z.ZodType<TaskSource>;
64
+ export declare const requirementSchema: z.ZodType<Requirement>;
65
+ export declare const taskMemorySchema: z.ZodType<TaskMemory>;
66
+ /** A bounded working set. Archived complete records remain in the host log. */
67
+ export declare const taskMemoryStateSchema: z.ZodType<TaskMemoryState>;
68
+ export declare const taskMemoryEventSchema: z.ZodType<TaskMemoryEvent>;
69
+ export declare const taskMemoryCreateSchema: z.ZodType<TaskMemoryCreate>;
70
+ export declare const taskMemoryPatchSchema: z.ZodType<TaskMemoryPatch>;
71
+ export declare function emptyTaskMemory(): TaskMemoryState;
72
+ export declare function requireTaskMemory(state: TaskMemoryState, taskId: string): TaskMemory;
73
+ /** Replace only explicitly named requirements; unchanged constraints retain their sources. */
74
+ export declare function reviseTaskMemory(task: TaskMemory, patch: TaskMemoryPatch, expectedRevision: number): TaskMemory;
75
+ /** Deterministic replay; old evidence stays recorded but is never current after revision. */
76
+ export declare function foldTaskMemory(state: TaskMemoryState, input: TaskMemoryEvent): TaskMemoryState;
77
+ /** Read a bounded recovery view without changing focus or the durable record. */
78
+ export declare function taskMemoryRead(task: TaskMemory, maxBytes: number): string;
79
+ /** Compact current state; full sources and evidence remain available via read(view=full). */
80
+ export declare function taskMemoryContext(state: TaskMemoryState, maxBytes: number): string;
81
+ //# sourceMappingURL=task-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-memory.d.ts","sourceRoot":"","sources":["../../src/core/task-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAErD,MAAM,WAAW,UAAU;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC1D,MAAM,WAAW,WAAW;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE;AAC7E,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,M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AAgB,EAAE,MAAM,GAAG,UAAU,CAkC/G;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,eAAe,CAY9F;AAgCD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOlF"}
@@ -0,0 +1,158 @@
1
+ import { z } from 'zod';
2
+ import { isDeepStrictEqual } from 'node:util';
3
+ import { TEAM_NAMES } from './teams.js';
4
+ const text = z.string().trim().min(1).max(4_000);
5
+ const id = z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}$/);
6
+ export const sourceSchema = z.object({ seq: z.number().int().nonnegative(), quote: text }).strict();
7
+ export const requirementSchema = z.object({ id, text, source: sourceSchema }).strict();
8
+ const evidenceSchema = z.object({
9
+ summary: text, ref: text, sourceVersion: text,
10
+ requirementsRevision: z.number().int().positive(),
11
+ kind: z.enum(['observed', 'assumption', 'test', 'decision']),
12
+ }).strict();
13
+ /** Task memory records requirements and recovery context; it never grants authority. */
14
+ const taskObject = z.object({
15
+ id, title: z.string().trim().min(1).max(200),
16
+ createdAtSeq: z.number().int().nonnegative(),
17
+ team: z.enum(TEAM_NAMES), depth: z.enum(['simple', 'complex']),
18
+ workspace: text, sourceVersion: text, goal: text,
19
+ source: sourceSchema,
20
+ requirements: z.array(requirementSchema).max(64),
21
+ acceptance: z.array(text).min(1).max(32),
22
+ decisions: z.array(text).max(16),
23
+ evidence: z.array(evidenceSchema).max(32),
24
+ next: z.string().max(4_000),
25
+ status: z.enum(['active', 'paused', 'completed', 'cancelled']),
26
+ revision: z.number().int().positive(),
27
+ requirementsRevision: z.number().int().positive(),
28
+ delegationRevision: z.number().int().positive(),
29
+ }).strict();
30
+ export const taskMemorySchema = taskObject;
31
+ /** A bounded working set. Archived complete records remain in the host log. */
32
+ export const taskMemoryStateSchema = z.object({
33
+ tasks: z.record(id, taskMemorySchema),
34
+ recentSources: z.array(z.number().int().nonnegative()).max(8),
35
+ focus: z.discriminatedUnion('kind', [z.object({ kind: z.literal('none') }).strict(), z.object({ kind: z.literal('task'), id }).strict()]),
36
+ }).strict();
37
+ export const taskMemoryEventSchema = z.discriminatedUnion('kind', [
38
+ z.object({ kind: z.literal('save'), task: taskMemorySchema }).strict(),
39
+ z.object({ kind: z.literal('focus'), id }).strict(),
40
+ z.object({ kind: z.literal('archive'), task: taskMemorySchema }).strict(),
41
+ ]);
42
+ export const taskMemoryCreateSchema = taskObject.omit({ createdAtSeq: true, revision: true, requirementsRevision: true, delegationRevision: true, status: true, evidence: true, decisions: true, next: true });
43
+ export const taskMemoryPatchSchema = z.object({
44
+ title: taskObject.shape.title.optional(), team: taskObject.shape.team.optional(), depth: taskObject.shape.depth.optional(),
45
+ goal: text.optional(), workspace: text.optional(), sourceVersion: text.optional(),
46
+ source: sourceSchema.optional(), requirements: z.array(requirementSchema).max(64).optional(),
47
+ removeRequirements: z.array(id).max(64).optional(), acceptance: taskObject.shape.acceptance.optional(),
48
+ decisions: taskObject.shape.decisions.optional(), evidence: taskObject.shape.evidence.optional(),
49
+ next: taskObject.shape.next.optional(), status: taskObject.shape.status.optional(),
50
+ }).strict();
51
+ export function emptyTaskMemory() { return { tasks: {}, recentSources: [], focus: { kind: 'none' } }; }
52
+ export function requireTaskMemory(state, taskId) {
53
+ if (!Object.hasOwn(state.tasks, taskId))
54
+ throw new Error(`Unknown task ${taskId}; read its archived event to restore it`);
55
+ return state.tasks[taskId];
56
+ }
57
+ /** Replace only explicitly named requirements; unchanged constraints retain their sources. */
58
+ export function reviseTaskMemory(task, patch, expectedRevision) {
59
+ if (task.revision !== expectedRevision)
60
+ throw new Error(`Stale task ${task.id}: expected ${expectedRevision}, current ${task.revision}`);
61
+ const normalized = taskMemoryPatchSchema.parse(patch);
62
+ if ((task.status === 'completed' || task.status === 'cancelled') && normalized.status !== undefined && normalized.status !== task.status) {
63
+ throw new Error('Archive and restore a finished task with a new user source before reopening it');
64
+ }
65
+ const requirements = new Map(task.requirements.map(item => [item.id, item]));
66
+ const removals = new Set(normalized.removeRequirements ?? []);
67
+ for (const key of removals) {
68
+ if (!requirements.delete(key))
69
+ throw new Error(`Cannot remove unknown requirement ${key}`);
70
+ }
71
+ const replacements = new Set();
72
+ for (const requirement of normalized.requirements ?? []) {
73
+ if (removals.has(requirement.id) || replacements.has(requirement.id))
74
+ throw new Error(`Conflicting requirement ${requirement.id}`);
75
+ replacements.add(requirement.id);
76
+ requirements.set(requirement.id, requirement);
77
+ }
78
+ const { removeRequirements: _removed, ...fields } = normalized;
79
+ const requiresSource = normalized.goal !== undefined || normalized.workspace !== undefined
80
+ || normalized.acceptance !== undefined || normalized.requirements !== undefined || removals.size > 0;
81
+ if (requiresSource && normalized.source === undefined)
82
+ throw new Error('A requirement change needs the source of the user correction');
83
+ // All validation precedes equality: a stale request or a new source is not a retry.
84
+ const candidate = taskMemorySchema.parse({ ...task, ...fields, requirements: [...requirements.values()] });
85
+ if (isDeepStrictEqual(candidate, task))
86
+ return task;
87
+ // Redundant requirement fields may accompany real progress. Only changed content
88
+ // or a new correction source invalidates work; source-only updates keep their contract.
89
+ const changed = requiresSource && (!isDeepStrictEqual(candidate.source, task.source)
90
+ || candidate.goal !== task.goal || candidate.workspace !== task.workspace
91
+ || !isDeepStrictEqual(candidate.acceptance, task.acceptance) || !isDeepStrictEqual(candidate.requirements, task.requirements));
92
+ const invalidatesDecisions = changed || (normalized.sourceVersion !== undefined && normalized.sourceVersion !== task.sourceVersion);
93
+ // A paused member must never become current merely because its parent resumes.
94
+ const invalidatesDelegation = invalidatesDecisions || (normalized.status !== undefined && normalized.status !== task.status);
95
+ return taskMemorySchema.parse({ ...task, ...fields, decisions: normalized.decisions ?? (invalidatesDecisions ? [] : task.decisions), requirements: [...requirements.values()], revision: task.revision + 1,
96
+ requirementsRevision: task.requirementsRevision + Number(changed), delegationRevision: task.delegationRevision + Number(invalidatesDelegation) });
97
+ }
98
+ /** Deterministic replay; old evidence stays recorded but is never current after revision. */
99
+ export function foldTaskMemory(state, input) {
100
+ const event = taskMemoryEventSchema.parse(input);
101
+ if (event.kind === 'focus') {
102
+ requireTaskMemory(state, event.id);
103
+ return { ...state, focus: { kind: 'task', id: event.id } };
104
+ }
105
+ if (event.kind === 'save') {
106
+ return { ...state, tasks: { ...state.tasks, [event.task.id]: event.task }, focus: state.focus.kind === 'none' ? { kind: 'task', id: event.task.id } : state.focus };
107
+ }
108
+ const tasks = { ...state.tasks };
109
+ delete tasks[event.task.id];
110
+ return { ...state, tasks, focus: state.focus.kind === 'task' && state.focus.id === event.task.id ? { kind: 'none' } : state.focus };
111
+ }
112
+ /** One recovery shape for runtime context and explicit reads. */
113
+ function taskResumeView(task) {
114
+ const validEvidence = task.evidence.filter(item => item.requirementsRevision === task.requirementsRevision && item.sourceVersion === task.sourceVersion);
115
+ // Bound the routine view, not the durable record. Keep the newest entries
116
+ // in their original order, with an explicit count for everything omitted.
117
+ const evidence = validEvidence.slice(-3).map(({ kind, summary, ref }) => ({ kind, summary, ref }));
118
+ return {
119
+ id: task.id, status: task.status, team: task.team, depth: task.depth,
120
+ revision: task.revision, requirementsRevision: task.requirementsRevision, delegationRevision: task.delegationRevision,
121
+ workspace: task.workspace, sourceVersion: task.sourceVersion, sourceSeq: task.source.seq,
122
+ goal: task.goal, requirements: task.requirements.map(({ id, text, source }) => ({ id, text, sourceSeq: source.seq })),
123
+ acceptance: task.acceptance, decisions: task.decisions, next: task.next,
124
+ evidence, omittedEvidence: validEvidence.length - evidence.length,
125
+ staleEvidence: task.evidence.length - validEvidence.length,
126
+ ...(evidence.length ? { evidenceBasis: 'recorded-versions; current workspace not checked' } : {}),
127
+ details: { tool: 'super_code_task', action: 'read', taskId: task.id, view: 'full' },
128
+ };
129
+ }
130
+ function serializeMemoryView(view, maxBytes) {
131
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
132
+ throw new Error('maxBytes must be a positive safe integer');
133
+ for (;;) {
134
+ const output = JSON.stringify(view).replace(/\{\{/g, '\\u007b\\u007b');
135
+ if (Buffer.byteLength(output, 'utf8') <= maxBytes)
136
+ return output;
137
+ if (view.current === undefined || view.current.evidence.length === 0)
138
+ throw new Error('Task context exceeds its budget; split the task or explicitly reduce notes. Hard requirements were not truncated.');
139
+ view.current.evidence.shift();
140
+ view.current.omittedEvidence++;
141
+ }
142
+ }
143
+ /** Read a bounded recovery view without changing focus or the durable record. */
144
+ export function taskMemoryRead(task, maxBytes) {
145
+ return serializeMemoryView({ current: taskResumeView(task) }, maxBytes);
146
+ }
147
+ /** Compact current state; full sources and evidence remain available via read(view=full). */
148
+ export function taskMemoryContext(state, maxBytes) {
149
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
150
+ throw new Error('maxBytes must be a positive safe integer');
151
+ const roster = Object.values(state.tasks).map(task => ({ id: task.id, title: task.title, status: task.status }));
152
+ if (roster.length === 0 && state.recentSources.length === 0)
153
+ return '';
154
+ const view = { tasks: roster, recentUserEventSeqs: state.recentSources,
155
+ ...(state.focus.kind === 'task' ? { current: taskResumeView(requireTaskMemory(state, state.focus.id)) } : {}) };
156
+ return serializeMemoryView(view, maxBytes);
157
+ }
158
+ //# sourceMappingURL=task-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-memory.js","sourceRoot":"","sources":["../../src/core/task-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAuBvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,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M,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAChH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACtE,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,aAAa;QACpE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IACjH,OAAO,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** Professional methods are loaded on demand, never a mandatory execution pipeline. */
2
+ export declare const TEAM_NAMES: readonly ["research", "design", "develop", "verify", "optimize"];
3
+ export type TeamName = typeof TEAM_NAMES[number];
4
+ export type WorkDepth = 'simple' | 'complex';
5
+ export interface TeamDefinition {
6
+ readonly outcome: string;
7
+ readonly approach: string;
8
+ readonly evidence: string;
9
+ readonly methods: readonly MethodName[];
10
+ }
11
+ /** Shared expertise, referenced by several teams without duplicating instructions. */
12
+ export type MethodName = 'investigation' | 'product' | 'bugfix' | 'architecture' | 'algorithm' | 'testing' | 'performance' | 'integration' | 'quality';
13
+ export declare const METHODS: Readonly<Record<MethodName, string>>;
14
+ export declare const TEAMS: Readonly<Record<TeamName, TeamDefinition>>;
15
+ /** Stable, compact instructions; the host logs selected methods as tool results. */
16
+ export declare const SUPER_CODE_INSTRUCTIONS = "You are super-code, responsible for completing the user's coding work.\nChoose by deliverable: research (facts), design (plan), develop (code), verify (checks), optimize (measured gains). Teams are specialties, not stages or resident agents. Use super_code_method only for missing expertise. No routing call or mandatory reflection loop.\nExplanation/design does not authorize edits; methods/teammates grant no permission. Ask only for decisions affecting correctness or scope. Finish and validate by risk; distinguish delivery, validation limits and blockers. Diagnosis is not a fix; stop without unrelated additions.\nFor long/interleaved work, use super_code_task for user-sourced requirements, acceptance, decisions/evidence and next dependency. Record material changes before switching/compaction, not every action. Preserve unaffected constraints; user corrections outrank old records. Never truncate hard requirements. Resume from current context; read only missing details and recheck mutable evidence. Focus/status questions do not cancel work.\nParallelize independent tools first. Delegate independent deliverables only for clear time or verification value. Reuse members only for related scope with valid context; never delegate recursively. Continue locally; one writer per file or isolated workspaces. For recorded tasks, delegate binds scope/ownership/versions; validate_member precedes lead review. Neither starts workers nor enforces runtime token budgets. Check key evidence, reject stale returns, count all attempts; unknown-stop is not success.\nResolve unclear APIs from requirements and callers, not guessed test names or aliases. Attribute failures to the environment only with baseline evidence; never assume later tests repair them. For hard problems, use a discriminating experiment, smaller reproduction or independent reference before expanding scope.\nMinimize total request cost. Reuse valid context; batch independent reads; avoid round trips for tiny savings. Keep required checks; inspect scaling and resource release. Report artifacts, actual checks and gaps briefly; no forced format or unmeasured gains.";
17
+ /** Read exactly the selected team/method; caller chooses using task meaning. */
18
+ export declare function readTeamMethod(team: TeamName, method?: MethodName): string;
19
+ //# sourceMappingURL=teams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/core/teams.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,UAAU,kEAAmE,CAAA;AAC1F,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;CACxC;AAED,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAA;AACtJ,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAU9C,CAAA;AAEX,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAM3D,CAAA;AAEF,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,gmEAM+N,CAAA;AAEnQ,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAM1E"}
@@ -0,0 +1,40 @@
1
+ /** Professional methods are loaded on demand, never a mandatory execution pipeline. */
2
+ export const TEAM_NAMES = ['research', 'design', 'develop', 'verify', 'optimize'];
3
+ export const METHODS = Object.freeze({
4
+ investigation: 'Start from the exact question, revision and observed failure. For competing causes, predict different observable outcomes and run the cheapest discriminating check; a result compatible with both proves neither. Use a minimal reproduction for broad failures, a matched good/bad run for regressions, and bisection only with a reliable pass/fail signal. Hold other conditions fixed and trace the first divergence through callers and data flow. If a check disproves the cause, change the hypothesis rather than expanding the patch. Stop at supported facts or explicit missing evidence; diagnosis alone does not authorize edits.',
5
+ product: 'Turn the requested outcome into a small end-to-end usable slice and verify it before expanding. Check actual users, inputs, normal/empty/error/cancel paths, persistence and existing conventions. Design interactions around user decisions, not internal machinery. Use existing interfaces and include only adjacent cases necessary for the outcome. Ask only when a missing product decision changes correctness or scope.',
6
+ bugfix: 'Reproduce the failing input and locate the first incorrect state before editing. Compare the same failing check on the baseline before attributing it to the environment. For async bugs, trace creation, update, invalidation, cancellation, late results and resource release. Control completion order with barriers instead of sleeps; test a late result after cancellation or replacement. Add a regression that fails before the fix at the causal boundary. If the patch expands, revisit the cause. Check affected callers and preserve unaffected behavior. Deliver the fix and actual checks, or name a concrete blocker; a passing mock is not live evidence.',
7
+ architecture: 'Map responsibilities, contracts, ownership, data lifetime and failure propagation. Choose the simplest boundary that resolves the demonstrated problem. Follow changed return types to callers, changed state to serialization/defaults/restoration, and changed async ownership to cancellation/cleanup. Search actual consumers; avoid building a repository-wide dependency graph for a local change. State migration/rollback costs and verify affected boundaries. Refactor only authorized scope; fewer lines or new abstractions do not prove improvement.',
8
+ algorithm: 'State input size, invariants, objective and correctness argument. Examine asymptotic time/space, numerical stability and adversarial cases. When correctness is hard to inspect, compare a simple reference on exhaustive small inputs or deterministic generated cases, then test representative large inputs. Minimize mismatches into regressions. A reference must be independent of the candidate, not the same algorithm copied twice. Prefer better algorithms/data structures before tuning constants; constant-factor gains do not prove better complexity. Report quality/accuracy tradeoffs.',
9
+ testing: 'Derive checks from behavior and the actual diff, not implementation text. Prioritize changed contracts and their callers, persisted state and restoration, async cancellation/late completion, or algorithm boundaries and scale. Cover relevant empty/invalid input, duplicates and failures. A regression must fail on the broken behavior and pass on the fix; use an independent reference for tricky algorithms. Confirm intended tests executed on the changed workspace: unchanged HEAD does not imply unchanged files; zero or entirely skipped tests are not passing evidence. Report commands and limits; no extra reviewer unless risk warrants it.',
10
+ performance: 'Measure a comparable baseline and locate the bottleneck before changing code. Fix workload, versions, resource allocation and warm/cold conditions. Inspect CPU, I/O, allocations, algorithmic scaling and contention. Compare repeated measurements and tail behavior, preserving correctness and recovery. Keep benchmarks isolated from competing jobs. Without comparable measurements, report a hypothesis, not a speedup. Stop at the target/budget or when no supported hypothesis remains.',
11
+ integration: 'Confirm the actual entry point, loaded package/build, deployed versions and effective configuration before diagnosing an integration. Inspect both sides of the contract: serialization, errors, timeouts, idempotency, cancellation and permissions. Verify one bounded end-to-end slice through the real entry point; source edits or a passing mock do not prove the installed artifact works. Distinguish local, mocked and live evidence, and name unavailable dependencies. Retain a recovery path for schema/data migrations; external writes still require authorization.',
12
+ quality: 'Define a fixed, representative evaluation set and acceptance criteria before candidates. Bind results to data, model/code and evaluator versions. Count failed attempts and all member/tool costs. Compare matched samples; investigate category regressions and hard cases. Do not tune against hidden tests, cherry-pick best runs or relax gates after observing failure.',
13
+ });
14
+ export const TEAMS = Object.freeze({
15
+ research: { outcome: 'Supported facts, diagnosis or technical judgment.', approach: 'Resolve uncertainty with traceable evidence; no implementation unless requested.', evidence: 'Sources, reproduced observations, counterexamples and explicit unknowns.', methods: ['investigation', 'integration'] },
16
+ design: { outcome: 'An implementable product, interface, algorithm or architecture design.', approach: 'Expose constraints and tradeoffs and specify the smallest complete solution.', evidence: 'Concrete contracts, usage examples, failure behavior and feasible acceptance checks.', methods: ['product', 'architecture', 'algorithm'] },
17
+ develop: { outcome: 'A working feature, bug fix, refactor, migration or integration.', approach: 'Inspect the existing implementation, change the cause and finish the authorized scope.', evidence: 'Working artifacts and relevant checks bound to the changed revision.', methods: ['product', 'bugfix', 'architecture', 'integration'] },
18
+ verify: { outcome: 'Tests, actionable review findings or acceptance evidence.', approach: 'Probe actual behavior and failure boundaries; distinguish environment failures.', evidence: 'Reproducible findings/checks, severity, source locations and validation limits.', methods: ['testing', 'integration'] },
19
+ optimize: { outcome: 'Demonstrated improvement and an adoption or rollback recommendation.', approach: 'Select goals separately from methods: latency, throughput, memory, cost, quality or maintainability.', evidence: 'Matched baseline/candidate measurements plus non-regression checks and stopping criteria.', methods: ['performance', 'algorithm', 'architecture', 'quality'] },
20
+ });
21
+ /** Stable, compact instructions; the host logs selected methods as tool results. */
22
+ export const SUPER_CODE_INSTRUCTIONS = `You are super-code, responsible for completing the user's coding work.
23
+ Choose by deliverable: research (facts), design (plan), develop (code), verify (checks), optimize (measured gains). Teams are specialties, not stages or resident agents. Use super_code_method only for missing expertise. No routing call or mandatory reflection loop.
24
+ Explanation/design does not authorize edits; methods/teammates grant no permission. Ask only for decisions affecting correctness or scope. Finish and validate by risk; distinguish delivery, validation limits and blockers. Diagnosis is not a fix; stop without unrelated additions.
25
+ For long/interleaved work, use super_code_task for user-sourced requirements, acceptance, decisions/evidence and next dependency. Record material changes before switching/compaction, not every action. Preserve unaffected constraints; user corrections outrank old records. Never truncate hard requirements. Resume from current context; read only missing details and recheck mutable evidence. Focus/status questions do not cancel work.
26
+ Parallelize independent tools first. Delegate independent deliverables only for clear time or verification value. Reuse members only for related scope with valid context; never delegate recursively. Continue locally; one writer per file or isolated workspaces. For recorded tasks, delegate binds scope/ownership/versions; validate_member precedes lead review. Neither starts workers nor enforces runtime token budgets. Check key evidence, reject stale returns, count all attempts; unknown-stop is not success.
27
+ Resolve unclear APIs from requirements and callers, not guessed test names or aliases. Attribute failures to the environment only with baseline evidence; never assume later tests repair them. For hard problems, use a discriminating experiment, smaller reproduction or independent reference before expanding scope.
28
+ Minimize total request cost. Reuse valid context; batch independent reads; avoid round trips for tiny savings. Keep required checks; inspect scaling and resource release. Report artifacts, actual checks and gaps briefly; no forced format or unmeasured gains.`;
29
+ /** Read exactly the selected team/method; caller chooses using task meaning. */
30
+ export function readTeamMethod(team, method) {
31
+ const definition = TEAMS[team];
32
+ if (!definition)
33
+ throw new Error(`Unknown team: ${team}`);
34
+ if (method !== undefined && !Object.hasOwn(METHODS, method))
35
+ throw new Error(`Unknown method: ${method}`);
36
+ if (method !== undefined)
37
+ return `${team}: ${definition.outcome}\n${method}: ${METHODS[method]}`;
38
+ return `${team}: ${definition.outcome}\n${definition.approach}\nEvidence: ${definition.evidence}\nMethods: ${definition.methods.join(', ')}`;
39
+ }
40
+ //# sourceMappingURL=teams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teams.js","sourceRoot":"","sources":["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E,OAAO,EAAE,sEAAsE,EAAE,QAAQ,EAAE,sGAAsG,EAAE,QAAQ,EAAE,2FAA2F,EAAE,OAAO,EAAE,CAAC,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE;CACzX,CAAC,CAAA;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;mQAM4N,CAAA;AAEnQ,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,IAAc,EAAE,MAAmB;IAChE,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAA;IACzD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAA;IACzG,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,KAAK,UAAU,CAAC,OAAO,KAAK,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;IAChG,OAAO,GAAG,IAAI,KAAK,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC,QAAQ,eAAe,UAAU,CAAC,QAAQ,cAAc,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;AAC9I,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { SessionEvent } from '@deepseek-ai/dsh-session';
2
+ export interface ToolEvidenceIdentity {
3
+ seq: number;
4
+ type: 'call' | 'result';
5
+ callId: string;
6
+ turn: number;
7
+ step: number;
8
+ tool?: string;
9
+ arguments?: string;
10
+ truncated?: boolean;
11
+ isError?: boolean;
12
+ }
13
+ /** Discover identities only on demand; unmatched events remain explicit across pages. */
14
+ export declare function listToolEvidence(end: number, before: number, eventAt: (seq: number) => SessionEvent | undefined, signal: AbortSignal): Promise<{
15
+ kind: 'directory';
16
+ records: ToolEvidenceIdentity[];
17
+ nextBeforeSeq: number;
18
+ done: boolean;
19
+ scanned: number;
20
+ }>;
21
+ export interface ToolEvidenceRef {
22
+ sessionId: string;
23
+ callSeq: number;
24
+ resultSeq: number;
25
+ }
26
+ export type ToolEvidence = {
27
+ kind: 'recorded';
28
+ ref: string;
29
+ tool: string;
30
+ callId: string;
31
+ time: number;
32
+ outcome: 'tool-returned' | 'tool-error';
33
+ arguments: string;
34
+ output: string;
35
+ truncated: boolean;
36
+ acceptance: 'not-established';
37
+ currentCode: 'not-verified';
38
+ outputChars: number;
39
+ outputView: 'complete' | 'head-tail' | 'page';
40
+ offset?: number;
41
+ readMore?: {
42
+ tool: 'super_code_task';
43
+ action: 'evidence';
44
+ record: {
45
+ ref: string;
46
+ offset: number;
47
+ };
48
+ };
49
+ } | {
50
+ kind: 'unavailable';
51
+ reason: string;
52
+ };
53
+ export declare function toolEvidenceRef(input: ToolEvidenceRef): string;
54
+ export declare function parseToolEvidenceRef(ref: string): ToolEvidenceRef;
55
+ /** Exact indexed reads only. A genuine tool return is not a test or delivery verdict. */
56
+ export declare function readToolEvidence(sessionId: string, ref: string, eventAt: (seq: number) => SessionEvent | undefined, offset?: number): ToolEvidence;
57
+ //# sourceMappingURL=tool-evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-evidence.d.ts","sourceRoot":"","sources":["../../src/core/tool-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,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AM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CACpG,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAG9D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAMjE;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CA6ClJ"}
@@ -0,0 +1,97 @@
1
+ import { scanSessionPage } from './session-scan.js';
2
+ /** Discover identities only on demand; unmatched events remain explicit across pages. */
3
+ export async function listToolEvidence(end, before, eventAt, signal) {
4
+ const records = [];
5
+ const page = await scanSessionPage(end, before, eventAt, event => {
6
+ if (event.type === 'tool/call')
7
+ records.push({ seq: event.seq, type: 'call', callId: event.data.callId,
8
+ turn: event.data.turn, step: event.data.step, tool: event.data.name, arguments: event.data.arguments.slice(0, 240), truncated: event.data.arguments.length > 240 });
9
+ if (event.type === 'tool/result' && event.data.message.content.length === 1) {
10
+ const block = event.data.message.content[0];
11
+ if (block.type === 'tool-result')
12
+ records.push({ seq: event.seq, type: 'result', callId: block.toolCallId,
13
+ turn: event.data.turn, step: event.data.step, isError: block.isError === true });
14
+ }
15
+ return records.length >= 12;
16
+ }, signal);
17
+ return { kind: 'directory', records, ...page };
18
+ }
19
+ export function toolEvidenceRef(input) {
20
+ if (!input.sessionId.trim() || !Number.isSafeInteger(input.callSeq) || input.callSeq < 0 || !Number.isSafeInteger(input.resultSeq) || input.resultSeq <= input.callSeq)
21
+ throw new Error('Invalid tool evidence identity');
22
+ return `dsh-tool:${encodeURIComponent(input.sessionId)}:${input.callSeq}:${input.resultSeq}`;
23
+ }
24
+ export function parseToolEvidenceRef(ref) {
25
+ const match = /^dsh-tool:([^:]+):(0|[1-9]\d*):(0|[1-9]\d*)$/.exec(ref);
26
+ if (!match)
27
+ throw new Error('Expected a dsh-tool evidence reference');
28
+ const result = { sessionId: decodeURIComponent(match[1]), callSeq: Number(match[2]), resultSeq: Number(match[3]) };
29
+ if (toolEvidenceRef(result) !== ref)
30
+ throw new Error('Noncanonical tool evidence reference');
31
+ return result;
32
+ }
33
+ /** Exact indexed reads only. A genuine tool return is not a test or delivery verdict. */
34
+ export function readToolEvidence(sessionId, ref, eventAt, offset) {
35
+ let identity;
36
+ try {
37
+ identity = parseToolEvidenceRef(ref);
38
+ }
39
+ catch {
40
+ return { kind: 'unavailable', reason: 'invalid reference' };
41
+ }
42
+ if (identity.sessionId !== sessionId)
43
+ return { kind: 'unavailable', reason: 'reference belongs to another session' };
44
+ const call = eventAt(identity.callSeq), result = eventAt(identity.resultSeq);
45
+ if (call?.seq !== identity.callSeq || call.type !== 'tool/call' || result?.seq !== identity.resultSeq || result.type !== 'tool/result')
46
+ return { kind: 'unavailable', reason: 'original tool records are missing' };
47
+ const blocks = result.data.message.content;
48
+ if (blocks.length !== 1 || blocks[0]?.type !== 'tool-result' || blocks[0].toolCallId !== call.data.callId || call.data.turn !== result.data.turn || call.data.step !== result.data.step)
49
+ return { kind: 'unavailable', reason: 'tool call and result do not match' };
50
+ const block = blocks[0];
51
+ // Keep references to original strings; never concatenate a large transcript.
52
+ const parts = block.content.filter(item => item.type === 'text').map(item => item.text);
53
+ const total = parts.reduce((sum, text, index) => sum + text.length + Number(index > 0), 0);
54
+ if (offset !== undefined && (!Number.isSafeInteger(offset) || offset < 0 || offset > total))
55
+ return { kind: 'unavailable', reason: 'output offset is outside the recorded text' };
56
+ const slice = (start, end) => {
57
+ let position = 0, value = '';
58
+ for (let index = 0; index < parts.length && position < end; index++) {
59
+ if (index > 0) {
60
+ if (position >= start && position < end)
61
+ value += '\n';
62
+ position++;
63
+ }
64
+ const part = parts[index];
65
+ if (position + part.length > start)
66
+ value += part.slice(Math.max(0, start - position), Math.max(0, end - position));
67
+ position += part.length;
68
+ }
69
+ return value;
70
+ };
71
+ const isHigh = (text) => /[\uD800-\uDBFF]$/.test(text);
72
+ if (offset !== undefined && offset > 0 && isHigh(slice(offset - 1, offset)) && /^[\uDC00-\uDFFF]/.test(slice(offset, offset + 1))) {
73
+ return { kind: 'unavailable', reason: 'output offset splits a Unicode character' };
74
+ }
75
+ const start = offset ?? 0;
76
+ let end = Math.min(total, start + 8000);
77
+ if (end < total && isHigh(slice(end - 1, end)))
78
+ end--;
79
+ const excerpt = offset === undefined && total > 8000;
80
+ let output = slice(start, end);
81
+ if (excerpt) {
82
+ let headEnd = 3000, tailStart = total - 4000;
83
+ if (isHigh(slice(headEnd - 1, headEnd)))
84
+ headEnd--;
85
+ if (isHigh(slice(tailStart - 1, tailStart)))
86
+ tailStart++;
87
+ output = `${slice(0, headEnd)}\n[Middle omitted; this excerpt is not a complete check result. Read pages only if needed.]\n${slice(tailStart, total)}`;
88
+ }
89
+ const nextOffset = excerpt ? 0 : end;
90
+ return { kind: 'recorded', ref, tool: call.data.name, callId: call.data.callId, time: result.time,
91
+ outcome: block.isError ? 'tool-error' : 'tool-returned', arguments: call.data.arguments.slice(0, 2000), output,
92
+ outputChars: total, outputView: excerpt ? 'head-tail' : offset !== undefined ? 'page' : 'complete',
93
+ ...(offset === undefined ? {} : { offset }),
94
+ ...(nextOffset < total ? { readMore: { tool: 'super_code_task', action: 'evidence', record: { ref, offset: nextOffset } } } : {}),
95
+ truncated: excerpt || start > 0 || end < total || call.data.arguments.length > 2000, acceptance: 'not-established', currentCode: 'not-verified' };
96
+ }
97
+ //# sourceMappingURL=tool-evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-evidence.js","sourceRoot":"","sources":["../../src/core/tool-evidence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AA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E,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnJ,SAAS,EAAE,OAAO,IAAI,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,CAAA;AACrJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Host-scoped projections only; execution and model selection belong to Harness. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ export declare const name = "super-code";
4
+ export declare function apply(ctx: Context): void;
5
+ export default apply;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dsh/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,eAAO,MAAM,IAAI,eAAe,CAAA;AAEhC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAKxC;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { superAgentUsageProjectionDefinition } from '../super-agent-usage.js';
2
+ import { taskMemoryProjection } from '../task-memory-projection.js';
3
+ export const name = 'super-code';
4
+ export function apply(ctx) {
5
+ ctx.inject(['sessionProjections'], projectionCtx => {
6
+ projectionCtx.sessionProjections.register(superAgentUsageProjectionDefinition);
7
+ projectionCtx.sessionProjections.register(taskMemoryProjection);
8
+ });
9
+ }
10
+ export default apply;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dsh/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAEnE,MAAM,CAAC,MAAM,IAAI,GAAG,YAAY,CAAA;AAEhC,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,GAAG,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,EAAE,aAAa,CAAC,EAAE;QACjD,aAAa,CAAC,kBAAkB,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAA;QAC9E,aAAa,CAAC,kBAAkB,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,22 @@
1
+ /** Agent-scoped tools and logged runtime context, using the installed Harness API. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import z from '@deepseek-ai/schemastery';
4
+ import type { GuidedRoute } from '../core/guidance.js';
5
+ export declare const name = "super-code";
6
+ export declare const inject: readonly string[];
7
+ export interface Config {
8
+ readonly maxTasks?: number;
9
+ readonly maxContextBytes?: number;
10
+ readonly guidedRoutes?: GuidedRoute[];
11
+ }
12
+ export declare const Config: z<Config>;
13
+ /** Installs no agent loop and starts no model calls. */
14
+ export declare function apply(ctx: Context, config?: Config): void;
15
+ declare const plugin: {
16
+ readonly name: string;
17
+ readonly inject: readonly string[];
18
+ readonly Config: z<Config>;
19
+ readonly apply: typeof apply;
20
+ };
21
+ export default plugin;
22
+ //# sourceMappingURL=super-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"super-code.d.ts","sourceRoot":"","sources":["../../src/dsh/super-code.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAgBxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAKtD,eAAO,MAAM,IAAI,eAAe,CAAA;AAChC,eAAO,MAAM,MAAM,EAAE,SAAS,MAAM,EAAgE,CAAA;AACpG,MAAM,WAAW,MAAM;IAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE;AAChI,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAI3B,CAAA;AAuCF,wDAAwD;AACxD,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAmJ7D;AAED,QAAA,MAAM,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAA;CAAoC,CAAA;AACvK,eAAe,MAAM,CAAA"}