@dsh-ray/assistant-growth-driver 0.0.1-seed.0 → 0.2.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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -1
  3. package/cordis.patch.yml +3 -0
  4. package/lib/association-intake.d.ts +55 -0
  5. package/lib/association-intake.d.ts.map +1 -0
  6. package/lib/association-intake.js +253 -0
  7. package/lib/association-intake.js.map +1 -0
  8. package/lib/config.d.ts +171 -0
  9. package/lib/config.d.ts.map +1 -0
  10. package/lib/config.js +401 -0
  11. package/lib/config.js.map +1 -0
  12. package/lib/deposit.d.ts +53 -0
  13. package/lib/deposit.d.ts.map +1 -0
  14. package/lib/deposit.js +56 -0
  15. package/lib/deposit.js.map +1 -0
  16. package/lib/dreaming-intake.d.ts +37 -0
  17. package/lib/dreaming-intake.d.ts.map +1 -0
  18. package/lib/dreaming-intake.js +180 -0
  19. package/lib/dreaming-intake.js.map +1 -0
  20. package/lib/growth-agent.d.ts +193 -0
  21. package/lib/growth-agent.d.ts.map +1 -0
  22. package/lib/growth-agent.js +1633 -0
  23. package/lib/growth-agent.js.map +1 -0
  24. package/lib/index.d.ts +79 -0
  25. package/lib/index.d.ts.map +1 -0
  26. package/lib/index.js +662 -0
  27. package/lib/index.js.map +1 -0
  28. package/lib/revision-target-matcher.d.ts +23 -0
  29. package/lib/revision-target-matcher.d.ts.map +1 -0
  30. package/lib/revision-target-matcher.js +51 -0
  31. package/lib/revision-target-matcher.js.map +1 -0
  32. package/lib/scanner-owner-runtime.d.ts +34 -0
  33. package/lib/scanner-owner-runtime.d.ts.map +1 -0
  34. package/lib/scanner-owner-runtime.js +99 -0
  35. package/lib/scanner-owner-runtime.js.map +1 -0
  36. package/lib/source-edits.d.ts +22 -0
  37. package/lib/source-edits.d.ts.map +1 -0
  38. package/lib/source-edits.js +77 -0
  39. package/lib/source-edits.js.map +1 -0
  40. package/lib/source-port.d.ts +223 -0
  41. package/lib/source-port.d.ts.map +1 -0
  42. package/lib/source-port.js +8 -0
  43. package/lib/source-port.js.map +1 -0
  44. package/lib/usage-runtime.d.ts +116 -0
  45. package/lib/usage-runtime.d.ts.map +1 -0
  46. package/lib/usage-runtime.js +853 -0
  47. package/lib/usage-runtime.js.map +1 -0
  48. package/lib/usage-store.d.ts +119 -0
  49. package/lib/usage-store.d.ts.map +1 -0
  50. package/lib/usage-store.js +343 -0
  51. package/lib/usage-store.js.map +1 -0
  52. package/lib/version.d.ts +2 -0
  53. package/lib/version.d.ts.map +1 -0
  54. package/lib/version.js +2 -0
  55. package/lib/version.js.map +1 -0
  56. package/lib/work-item-source.d.ts +63 -0
  57. package/lib/work-item-source.d.ts.map +1 -0
  58. package/lib/work-item-source.js +126 -0
  59. package/lib/work-item-source.js.map +1 -0
  60. package/package.json +146 -4
package/lib/config.js ADDED
@@ -0,0 +1,401 @@
1
+ import { isAbsolute, resolve } from 'node:path';
2
+ import Schema from '@deepseek-ai/schemastery';
3
+ import { validateWorkItemGrowthAuthorityPins, validateWorkItemRevisionAuthorityPins } from '@dsh-ray/assistant-growth-contract';
4
+ const fields = new Set([
5
+ 'enabled',
6
+ 'intervalMs',
7
+ 'maxReviewsPerWake',
8
+ 'minRepeatedSuccesses',
9
+ 'candidateTtlMs',
10
+ 'maxModelCalls',
11
+ 'maxToolCalls',
12
+ 'maxOutputTokens',
13
+ 'maxDurationMs',
14
+ 'toolPresentation',
15
+ 'provider',
16
+ 'model',
17
+ 'reasoningEffort',
18
+ 'budgetId',
19
+ 'budgetAmount',
20
+ 'apiKeyEnv',
21
+ 'scope',
22
+ 'workflowOwnerAnchored',
23
+ 'pluginSourceProposals',
24
+ 'dreamingIdeas',
25
+ 'associationCandidates',
26
+ 'usageLearning',
27
+ ]);
28
+ const ref = Schema.string().pattern(/^[A-Z_][A-Z0-9_]*$/u);
29
+ const boundedText = (max) => Schema.string().min(1).max(max).pattern(/^[^\s\p{Cc}](?:[^\p{Cc}]*[^\s\p{Cc}])?$/u);
30
+ // schemastery gives every object schema a default of {}, which would otherwise
31
+ // deep-validate a missing scope against the required inner fields. Pin the
32
+ // default to undefined so an undeclared scope stays absent (fail-closed config
33
+ // validation happens explicitly in normalizeConfig). The cast bridges the
34
+ // library typings, whose default() parameter excludes undefined even though the
35
+ // runtime stores and returns it verbatim.
36
+ const scopeSchema = Schema.object({
37
+ workspace: boundedText(4_096).required(),
38
+ preset: boundedText(256).required(),
39
+ principalId: boundedText(256).required(),
40
+ ownerRouteId: boundedText(256).required(),
41
+ }).default(undefined);
42
+ // Same missing-object default rationale as scopeSchema above. The inner fields
43
+ // are optional in WorkflowOwnerAnchoredConfig (they all carry schema defaults),
44
+ // so cast the object schema to that optional-input type before pinning its
45
+ // missing-object default to undefined.
46
+ const workflowOwnerAnchoredObjectSchema = Schema.object({
47
+ enabled: Schema.boolean().default(true),
48
+ maxCommitsPerWake: Schema.natural().min(1).max(50).default(5),
49
+ lookbackMs: Schema.natural().min(60_000).max(604_800_000).default(86_400_000),
50
+ });
51
+ const workflowOwnerAnchoredSchema = workflowOwnerAnchoredObjectSchema
52
+ .default(undefined);
53
+ // Same missing-object default rationale as workflowOwnerAnchoredSchema above.
54
+ const pluginSourceProposalsObjectSchema = Schema.object({
55
+ enabled: Schema.boolean().default(true),
56
+ allowCreation: Schema.boolean().default(true),
57
+ allowModification: Schema.boolean().default(true),
58
+ allowRevision: Schema.boolean().default(true),
59
+ preparationMode: Schema.union(['inline', 'durable']).default('durable'),
60
+ repository: boundedText(4_096),
61
+ maxPlansPerWake: Schema.natural().min(1).max(5).default(1),
62
+ // Security root: the isolated build gate must finish well inside the 300000 ms
63
+ // growth authority lifetime; bounds mirror the control-plane service limits.
64
+ isolatedBuildTimeoutMs: Schema.natural().min(60_000).max(240_000).default(180_000),
65
+ offline: Schema.boolean().default(true),
66
+ planTtlMs: Schema.natural().min(900_000).max(86_400_000).default(86_400_000),
67
+ });
68
+ const pluginSourceProposalsSchema = pluginSourceProposalsObjectSchema
69
+ .default(undefined);
70
+ const dreamingIdeasObjectSchema = Schema.object({
71
+ enabled: Schema.boolean().default(true),
72
+ maxIdeasPerWake: Schema.natural().min(1).max(10).default(3),
73
+ });
74
+ const dreamingIdeasSchema = dreamingIdeasObjectSchema
75
+ .default(undefined);
76
+ const associationCandidatesObjectSchema = Schema.object({
77
+ enabled: Schema.boolean().default(true),
78
+ maxCandidatesPerWake: Schema.natural().min(1).max(10).default(3),
79
+ });
80
+ const associationCandidatesSchema = associationCandidatesObjectSchema
81
+ .default(undefined);
82
+ const schema = Schema.object({
83
+ enabled: Schema.boolean().default(true),
84
+ intervalMs: Schema.natural().min(0).max(86_400_000).default(0),
85
+ maxReviewsPerWake: Schema.natural().min(1).max(50).default(10),
86
+ minRepeatedSuccesses: Schema.natural().min(1).max(32).default(3),
87
+ // Store-imposed ceiling: candidates expire at most 7 days after staging.
88
+ candidateTtlMs: Schema.natural().min(1_000).max(604_800_000).default(86_400_000),
89
+ maxModelCalls: Schema.natural().min(1).max(64).default(8),
90
+ maxToolCalls: Schema.natural().min(0).max(128).default(24),
91
+ maxOutputTokens: Schema.natural().min(1).max(32_768).default(8_192),
92
+ // Security root: a growth authority may never live longer than 300000 ms.
93
+ maxDurationMs: Schema.natural().min(1_000).max(300_000).default(120_000),
94
+ // Presentation only; the frozen allowlist/approval/budget contract below is
95
+ // identical in both modes. Absence of a PTC runtime is a runtime failure, not
96
+ // a config-time fallback.
97
+ toolPresentation: Schema.union(['native', 'ptc']).default('native'),
98
+ provider: boundedText(256),
99
+ model: boundedText(256),
100
+ reasoningEffort: boundedText(128),
101
+ budgetId: boundedText(128),
102
+ budgetAmount: Schema.natural().min(1).max(1_000_000_000),
103
+ apiKeyEnv: ref,
104
+ scope: scopeSchema,
105
+ workflowOwnerAnchored: workflowOwnerAnchoredSchema,
106
+ pluginSourceProposals: pluginSourceProposalsSchema,
107
+ dreamingIdeas: dreamingIdeasSchema,
108
+ associationCandidates: associationCandidatesSchema,
109
+ usageLearning: Schema.object({ workItemFailures: Schema.boolean().default(true), workItemAuthorities: Schema.any(), workItemRevisionAuthorities: Schema.any(),
110
+ enabled: Schema.boolean().default(true), databasePath: boundedText(4096),
111
+ scanBudgetId: boundedText(128),
112
+ scanBudgetAmount: Schema.natural().min(1).max(10_000_000),
113
+ maxPending: Schema.natural().min(1).max(100).default(16),
114
+ lookbackMs: Schema.natural().min(60_000).max(604_800_000).default(86_400_000),
115
+ }).default(undefined),
116
+ });
117
+ const explicitConfigInputs = new WeakMap();
118
+ function snapshotExplicitInput(raw) {
119
+ if (raw === undefined)
120
+ return {};
121
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
122
+ return undefined;
123
+ const out = {};
124
+ for (const [key, value] of Object.entries(raw)) {
125
+ out[key] = value !== null && typeof value === 'object' && !Array.isArray(value)
126
+ ? { ...value }
127
+ : value;
128
+ }
129
+ return out;
130
+ }
131
+ export const Config = new Proxy(schema, {
132
+ apply(target, thisArg, argumentsList) {
133
+ const value = argumentsList[0];
134
+ if (value !== undefined && (value === null || typeof value !== 'object' || Array.isArray(value)))
135
+ throw new Error('assistant-growth-driver: config must be an object');
136
+ if (value !== undefined)
137
+ for (const key of Object.keys(value))
138
+ if (!fields.has(key))
139
+ throw new Error(`assistant-growth-driver: unknown config field: ${key}`);
140
+ const explicit = (value !== null && typeof value === 'object' ? explicitConfigInputs.get(value) : undefined)
141
+ ?? snapshotExplicitInput(value);
142
+ const parsed = Reflect.apply(target, thisArg, argumentsList);
143
+ if (parsed !== null && typeof parsed === 'object' && explicit !== undefined) {
144
+ explicitConfigInputs.set(parsed, explicit);
145
+ }
146
+ return parsed;
147
+ },
148
+ get(target, prop, receiver) {
149
+ if (prop === '~standard') {
150
+ const std = Reflect.get(target, prop, target);
151
+ return {
152
+ ...std,
153
+ validate(value, options) {
154
+ if (value !== undefined && (value === null || typeof value !== 'object' || Array.isArray(value))) {
155
+ return { issues: [{ message: 'assistant-growth-driver: config must be an object' }] };
156
+ }
157
+ if (value !== undefined) {
158
+ for (const key of Object.keys(value)) {
159
+ if (!fields.has(key)) {
160
+ return { issues: [{ message: `assistant-growth-driver: unknown config field: ${key}` }] };
161
+ }
162
+ }
163
+ }
164
+ const explicit = (value !== null && typeof value === 'object' ? explicitConfigInputs.get(value) : undefined)
165
+ ?? snapshotExplicitInput(value);
166
+ const result = std.validate(value, options);
167
+ const attach = (res) => {
168
+ if (res && typeof res === 'object' && !res.issues && res.value !== null && typeof res.value === 'object'
169
+ && explicit !== undefined) {
170
+ explicitConfigInputs.set(res.value, explicit);
171
+ }
172
+ return res;
173
+ };
174
+ return result instanceof Promise ? result.then(attach) : attach(result);
175
+ },
176
+ };
177
+ }
178
+ return Reflect.get(target, prop, receiver);
179
+ },
180
+ });
181
+ export function normalizeConfig(input) {
182
+ const rawInput = (input !== undefined && input !== null && typeof input === 'object' && !Array.isArray(input))
183
+ ? (explicitConfigInputs.get(input) ?? input)
184
+ : undefined;
185
+ if (rawInput?.usageLearning && Object.hasOwn(rawInput.usageLearning, 'workItemFailures')
186
+ && typeof rawInput.usageLearning.workItemFailures !== 'boolean')
187
+ throw new Error('assistant-growth-driver: workItemFailures must be a boolean');
188
+ const explicitEnabled = rawInput?.enabled;
189
+ const explicitWorkflow = rawInput?.workflowOwnerAnchored?.enabled;
190
+ const explicitSource = rawInput?.pluginSourceProposals?.enabled;
191
+ const explicitCreation = rawInput?.pluginSourceProposals?.allowCreation;
192
+ const explicitRevision = rawInput?.pluginSourceProposals?.allowRevision;
193
+ const explicitPrepMode = rawInput?.pluginSourceProposals?.preparationMode;
194
+ const explicitDreaming = rawInput?.dreamingIdeas?.enabled;
195
+ const explicitAssociation = rawInput?.associationCandidates?.enabled;
196
+ const explicitUsage = rawInput?.usageLearning?.enabled;
197
+ const explicitWorkItemFailures = rawInput?.usageLearning?.workItemFailures;
198
+ const explicitRepositoryProvided = rawInput?.pluginSourceProposals !== undefined
199
+ && Object.hasOwn(rawInput.pluginSourceProposals, 'repository')
200
+ && rawInput.pluginSourceProposals.repository !== undefined;
201
+ const explicitUsageFieldsProvided = rawInput?.usageLearning !== undefined
202
+ && (rawInput.usageLearning.databasePath !== undefined
203
+ || rawInput.usageLearning.scanBudgetId !== undefined
204
+ || rawInput.usageLearning.scanBudgetAmount !== undefined);
205
+ const rawProvider = rawInput?.provider;
206
+ const rawModel = rawInput?.model;
207
+ const rawReasoning = rawInput?.reasoningEffort;
208
+ for (const value of [rawProvider, rawModel, rawReasoning]) {
209
+ if (typeof value === 'string' && value.length > 0 && (value.trim() !== value || [...value].some(character => {
210
+ const code = character.codePointAt(0);
211
+ return code <= 31 || code === 127;
212
+ }))) {
213
+ throw new Error('assistant-growth-driver: invalid model route');
214
+ }
215
+ }
216
+ const config = Config(input);
217
+ if (config.apiKeyEnv !== undefined && !/^[A-Z_][A-Z0-9_]*$/u.test(config.apiKeyEnv))
218
+ throw new Error('assistant-growth-driver: invalid apiKeyEnv');
219
+ const pins = config.usageLearning?.workItemAuthorities;
220
+ if (pins !== undefined)
221
+ validateWorkItemGrowthAuthorityPins(pins);
222
+ if (pins !== undefined && explicitWorkItemFailures === false)
223
+ throw new Error('assistant-growth-driver: workItemAuthorities require workItemFailures');
224
+ const revisionPins = config.usageLearning?.workItemRevisionAuthorities;
225
+ if (revisionPins !== undefined)
226
+ validateWorkItemRevisionAuthorityPins(revisionPins);
227
+ if (revisionPins !== undefined && explicitWorkItemFailures === false) {
228
+ throw new Error('assistant-growth-driver: workItemRevisionAuthorities require workItemFailures');
229
+ }
230
+ const frozenPins = pins === undefined ? undefined : Object.freeze({ ...pins,
231
+ sourceJobs: Object.freeze({ ...pins.sourceJobs }), creationGrant: Object.freeze({ ...pins.creationGrant }),
232
+ creationAcceptance: Object.freeze({ ...pins.creationAcceptance }), adoption: Object.freeze({ ...pins.adoption }) });
233
+ const frozenRevisionPins = revisionPins === undefined ? undefined : Object.freeze({ ...revisionPins,
234
+ sourceJobs: Object.freeze({ ...revisionPins.sourceJobs }), revisionGrant: Object.freeze({ ...revisionPins.revisionGrant }),
235
+ revisionAcceptance: Object.freeze({ ...revisionPins.revisionAcceptance }),
236
+ ...(revisionPins.revisionRegressionAcceptance === undefined ? {} : { revisionRegressionAcceptance: Object.freeze({ ...revisionPins.revisionRegressionAcceptance }) }),
237
+ ...(revisionPins.revisionAdoption === undefined ? {} : { revisionAdoption: Object.freeze({ ...revisionPins.revisionAdoption }) }) });
238
+ const driverEnabled = explicitEnabled ?? true;
239
+ const workflowEnabled = driverEnabled ? (explicitWorkflow ?? true) : false;
240
+ const sourceEnabled = driverEnabled ? (explicitSource ?? true) : false;
241
+ const prepMode = explicitPrepMode ?? 'durable';
242
+ const allowCreation = sourceEnabled ? (explicitCreation ?? (explicitPrepMode === 'inline' ? false : true)) : false;
243
+ const dreamingEnabled = driverEnabled ? (explicitDreaming ?? true) : false;
244
+ const associationEnabled = driverEnabled ? (explicitAssociation ?? true) : false;
245
+ const usageEnabled = driverEnabled ? (explicitUsage ?? true) : false;
246
+ const allowRevision = sourceEnabled && prepMode === 'durable' && usageEnabled ? (explicitRevision ?? true) : false;
247
+ const workItemFailuresEnabled = usageEnabled && sourceEnabled && prepMode === 'durable' && allowCreation
248
+ ? (explicitWorkItemFailures ?? true) : false;
249
+ const normalized = Object.freeze({
250
+ enabled: driverEnabled,
251
+ intervalMs: config.intervalMs ?? 0,
252
+ maxReviewsPerWake: config.maxReviewsPerWake ?? 10,
253
+ minRepeatedSuccesses: config.minRepeatedSuccesses ?? 3,
254
+ candidateTtlMs: config.candidateTtlMs ?? 86_400_000,
255
+ maxModelCalls: config.maxModelCalls ?? 8,
256
+ maxToolCalls: config.maxToolCalls ?? 24,
257
+ maxOutputTokens: config.maxOutputTokens ?? 8_192,
258
+ maxDurationMs: config.maxDurationMs ?? 120_000,
259
+ toolPresentation: config.toolPresentation ?? 'native',
260
+ provider: config.provider ?? null,
261
+ model: config.model ?? null,
262
+ reasoningEffort: config.reasoningEffort ?? null,
263
+ budgetId: config.budgetId ?? null,
264
+ budgetAmount: config.budgetAmount ?? null,
265
+ apiKeyEnv: config.apiKeyEnv ?? null,
266
+ scope: config.scope ? Object.freeze({ ...config.scope }) : null,
267
+ workflowOwnerAnchored: Object.freeze({
268
+ enabled: workflowEnabled,
269
+ maxCommitsPerWake: config.workflowOwnerAnchored?.maxCommitsPerWake ?? 5,
270
+ lookbackMs: config.workflowOwnerAnchored?.lookbackMs ?? 86_400_000,
271
+ }),
272
+ pluginSourceProposals: Object.freeze({
273
+ enabled: sourceEnabled,
274
+ allowCreation,
275
+ allowModification: config.pluginSourceProposals?.allowModification ?? true,
276
+ allowRevision,
277
+ preparationMode: prepMode,
278
+ repository: config.pluginSourceProposals?.repository?.normalize('NFC').trim() ?? null,
279
+ maxPlansPerWake: config.pluginSourceProposals?.maxPlansPerWake ?? 1,
280
+ isolatedBuildTimeoutMs: config.pluginSourceProposals?.isolatedBuildTimeoutMs ?? 180_000,
281
+ offline: config.pluginSourceProposals?.offline ?? true,
282
+ planTtlMs: config.pluginSourceProposals?.planTtlMs ?? 86_400_000,
283
+ }),
284
+ dreamingIdeas: Object.freeze({
285
+ enabled: dreamingEnabled,
286
+ maxIdeasPerWake: config.dreamingIdeas?.maxIdeasPerWake ?? 3,
287
+ }),
288
+ associationCandidates: Object.freeze({
289
+ enabled: associationEnabled,
290
+ maxCandidatesPerWake: config.associationCandidates?.maxCandidatesPerWake ?? 3,
291
+ }),
292
+ usageLearning: Object.freeze({ ...(workItemFailuresEnabled ? { workItemFailures: true,
293
+ ...(frozenPins === undefined ? {} : { workItemAuthorities: frozenPins }) } : {}),
294
+ ...(frozenRevisionPins === undefined ? {} : { workItemRevisionAuthorities: frozenRevisionPins }),
295
+ enabled: usageEnabled,
296
+ scanBudgetId: config.usageLearning?.scanBudgetId ?? null,
297
+ scanBudgetAmount: config.usageLearning?.scanBudgetAmount ?? null,
298
+ databasePath: config.usageLearning?.databasePath ?? null, maxPending: config.usageLearning?.maxPending ?? 16,
299
+ lookbackMs: config.usageLearning?.lookbackMs ?? 86_400_000 }),
300
+ });
301
+ if (explicitEnabled === true && !normalized.scope)
302
+ throw new Error('assistant-growth-driver: enabled requires an explicit owner scope');
303
+ if ((normalized.provider === null) !== (normalized.model === null)) {
304
+ throw new Error('assistant-growth-driver: provider and model must be configured together');
305
+ }
306
+ if (normalized.reasoningEffort !== null && normalized.provider === null) {
307
+ throw new Error('assistant-growth-driver: reasoningEffort requires an explicit provider and model');
308
+ }
309
+ for (const value of [normalized.provider, normalized.model, normalized.reasoningEffort]) {
310
+ if (value !== null && (value.trim() !== value || value.length === 0 || [...value].some(character => {
311
+ const code = character.codePointAt(0);
312
+ return code <= 31 || code === 127;
313
+ }))) {
314
+ throw new Error('assistant-growth-driver: invalid model route');
315
+ }
316
+ }
317
+ if (explicitWorkflow === true && !normalized.enabled) {
318
+ throw new Error('assistant-growth-driver: workflowOwnerAnchored.enabled requires the driver itself to be enabled');
319
+ }
320
+ if (explicitWorkflow === true && !normalized.scope) {
321
+ throw new Error('assistant-growth-driver: workflowOwnerAnchored.enabled requires an explicit owner scope');
322
+ }
323
+ if (explicitSource === true && !normalized.enabled) {
324
+ throw new Error('assistant-growth-driver: pluginSourceProposals.enabled requires the driver itself to be enabled');
325
+ }
326
+ if (explicitSource === true && !normalized.scope) {
327
+ throw new Error('assistant-growth-driver: pluginSourceProposals.enabled requires an explicit owner scope');
328
+ }
329
+ if (normalized.pluginSourceProposals.enabled) {
330
+ if (!normalized.pluginSourceProposals.offline)
331
+ throw new Error('assistant-growth-driver: source preparation requires offline mode');
332
+ const repository = normalized.pluginSourceProposals.repository;
333
+ // Canonical TEXT only here (the control-plane service performs the realpath
334
+ // canonicalization against the live filesystem at prepare time): absolute,
335
+ // non-empty and free of '.'/'..' normalization segments.
336
+ if (repository !== null && (!isAbsolute(repository) || resolve(repository) !== repository)) {
337
+ throw new Error('assistant-growth-driver: pluginSourceProposals.repository must be a canonical absolute path when enabled');
338
+ }
339
+ if ((explicitSource === true || explicitRepositoryProvided) && repository === null) {
340
+ throw new Error('assistant-growth-driver: pluginSourceProposals.repository must be a canonical absolute path when enabled');
341
+ }
342
+ }
343
+ if (explicitCreation === true
344
+ && (!normalized.pluginSourceProposals.enabled || normalized.pluginSourceProposals.preparationMode !== 'durable')) {
345
+ throw new Error('assistant-growth-driver: source creation requires enabled durable source proposals');
346
+ }
347
+ if (normalized.pluginSourceProposals.enabled && !normalized.pluginSourceProposals.allowModification
348
+ && !normalized.pluginSourceProposals.allowCreation && !normalized.pluginSourceProposals.allowRevision) {
349
+ throw new Error('assistant-growth-driver: source proposals require at least one allowed mode');
350
+ }
351
+ if (explicitDreaming === true && !normalized.enabled) {
352
+ throw new Error('assistant-growth-driver: dreamingIdeas.enabled requires the driver itself to be enabled');
353
+ }
354
+ if (explicitDreaming === true && !normalized.scope) {
355
+ throw new Error('assistant-growth-driver: dreamingIdeas.enabled requires an explicit owner scope');
356
+ }
357
+ if (explicitAssociation === true && !normalized.enabled) {
358
+ throw new Error('assistant-growth-driver: associationCandidates.enabled requires the driver itself to be enabled');
359
+ }
360
+ if (explicitAssociation === true && !normalized.scope) {
361
+ throw new Error('assistant-growth-driver: associationCandidates.enabled requires an explicit owner scope');
362
+ }
363
+ if (explicitRevision === true
364
+ && (!normalized.pluginSourceProposals.enabled || normalized.pluginSourceProposals.preparationMode !== 'durable'
365
+ || !normalized.usageLearning.enabled)) {
366
+ throw new Error('assistant-growth-driver: source revision requires enabled durable source proposals and usage learning');
367
+ }
368
+ if ((normalized.budgetId === null) !== (normalized.budgetAmount === null)) {
369
+ throw new Error('assistant-growth-driver: budgetId and budgetAmount must be configured together');
370
+ }
371
+ if (explicitWorkItemFailures === true && (!normalized.usageLearning.enabled
372
+ || !normalized.pluginSourceProposals.enabled || normalized.pluginSourceProposals.preparationMode !== 'durable'
373
+ || !normalized.pluginSourceProposals.allowCreation || frozenPins === undefined)) {
374
+ throw new Error('assistant-growth-driver: work item failures require durable creation, usage learning and explicit authorities');
375
+ }
376
+ if (frozenRevisionPins !== undefined && (!normalized.pluginSourceProposals.allowRevision
377
+ || normalized.pluginSourceProposals.preparationMode !== 'durable')) {
378
+ throw new Error('assistant-growth-driver: work item revision authorities require durable revision proposals');
379
+ }
380
+ if (explicitUsage === true || (normalized.usageLearning.enabled && explicitUsageFieldsProvided)) {
381
+ const path = normalized.usageLearning.databasePath;
382
+ if (!normalized.enabled || !normalized.scope || !normalized.budgetId || normalized.intervalMs !== 0
383
+ || path === null || !isAbsolute(path) || resolve(path) !== path) {
384
+ throw new Error('assistant-growth-driver: usageLearning requires enabled owner scope, budget, absolute databasePath and intervalMs=0');
385
+ }
386
+ const scanBudget = normalized.usageLearning.scanBudgetId;
387
+ if (scanBudget === null || scanBudget.trim() !== scanBudget || scanBudget.length === 0
388
+ || scanBudget.normalize('NFC') !== scanBudget || /[\p{Cc}]/u.test(scanBudget)
389
+ || normalized.usageLearning.scanBudgetAmount === null) {
390
+ throw new Error('assistant-growth-driver: usageLearning requires scanBudgetId and scanBudgetAmount for native discovery');
391
+ }
392
+ }
393
+ else if (normalized.usageLearning.databasePath !== null) {
394
+ const path = normalized.usageLearning.databasePath;
395
+ if (!isAbsolute(path) || resolve(path) !== path) {
396
+ throw new Error('assistant-growth-driver: usageLearning requires enabled owner scope, budget, absolute databasePath and intervalMs=0');
397
+ }
398
+ }
399
+ return normalized;
400
+ }
401
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAC7C,OAAO,EAAE,mCAAmC,EAAE,qCAAqC,EACX,MAAM,oCAAoC,CAAA;AAwKlH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;IACrB,SAAS;IACT,YAAY;IACZ,mBAAmB;IACnB,sBAAsB;IACtB,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,iB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I,CAAC;QACD,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,CAAC,YAAY,CAAA;QACxD,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;eACjF,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;eAC1E,UAAU,CAAC,aAAa,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,wGAAwG,CAAC,CAAA;QAC3H,CAAC;IACH,CAAC;SAAM,IAAI,UAAU,CAAC,aAAa,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,aAAa,CAAC,YAAY,CAAA;QAClD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,qHAAqH,CAAC,CAAA;QACxI,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { GoalScope, OwnerGoalExecutionSnapshotInput } from '@dsh-ray/assistant-goals';
2
+ import type { CommitOwnerAnchoredWorkflowTraceServiceResult } from '@dsh-ray/assistant-delivery';
3
+ import type { GrowthOwnerScopeConfig } from './config.js';
4
+ /**
5
+ * A growth authority is the Host-side analogue of RepairExecutionAuthority,
6
+ * but it is NOT backed by any durable repair continuation: the driver mints it
7
+ * from the frozen configured owner scope for exactly one bounded wake. It can
8
+ * draft a pending skill candidate and nothing else.
9
+ */
10
+ export interface GrowthAuthority {
11
+ readonly id: string;
12
+ readonly scope: GoalScope;
13
+ readonly ownerRouteId: string;
14
+ readonly expiresAt: number;
15
+ assertCurrent(): void;
16
+ }
17
+ export interface OwnerRouteReceipt {
18
+ readonly receiptVersion: 2;
19
+ readonly authorityId: string;
20
+ readonly authorityHash: string;
21
+ readonly principalId: string;
22
+ readonly principalRecordId: string;
23
+ readonly principalVersion: number;
24
+ readonly workspace: string;
25
+ readonly agentPreset: string;
26
+ readonly bindingVersion: number;
27
+ readonly generation: number;
28
+ }
29
+ export interface GrowthDeliveryPort {
30
+ validateOwnerRoute(input: {
31
+ authorityId: string;
32
+ principalId: string;
33
+ workspace: string;
34
+ agentPreset: string;
35
+ }): Readonly<OwnerRouteReceipt>;
36
+ /**
37
+ * Host-only owner-anchored learning seam. The driver passes only a locator
38
+ * and the bounded-wake authority; Delivery re-fetches the verified Goals
39
+ * source and run proof itself and never accepts a caller-supplied prompt.
40
+ */
41
+ commitOwnerAnchoredWorkflowTrace(input: Readonly<{
42
+ locator: OwnerGoalExecutionSnapshotInput;
43
+ authority: GrowthAuthority;
44
+ }>): Promise<Readonly<CommitOwnerAnchoredWorkflowTraceServiceResult>>;
45
+ }
46
+ /**
47
+ * Re-anchor the configured owner scope against the live authenticated Delivery
48
+ * owner route and mint one short-lived growth authority. Never derives an
49
+ * owner from model-controlled values: the route id, principal, workspace and
50
+ * preset all come from frozen plugin configuration.
51
+ */
52
+ export declare function mintGrowthAuthority(delivery: GrowthDeliveryPort, config: GrowthOwnerScopeConfig, expiresAt: number, allowNewSession?: boolean): GrowthAuthority;
53
+ //# sourceMappingURL=deposit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../src/deposit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1F,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,6BAA6B,CAAA;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB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deposit.js ADDED
@@ -0,0 +1,56 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { acceptanceDigest } from '@dsh-ray/task-acceptance-contract';
3
+ import { isSourceOwnerContinuation } from '@dsh-ray/assistant-growth-contract';
4
+ /**
5
+ * Re-anchor the configured owner scope against the live authenticated Delivery
6
+ * owner route and mint one short-lived growth authority. Never derives an
7
+ * owner from model-controlled values: the route id, principal, workspace and
8
+ * preset all come from frozen plugin configuration.
9
+ */
10
+ export function mintGrowthAuthority(delivery, config, expiresAt, allowNewSession = false) {
11
+ const anchor = delivery.validateOwnerRoute({
12
+ authorityId: config.ownerRouteId,
13
+ principalId: config.principalId,
14
+ workspace: config.workspace,
15
+ agentPreset: config.preset,
16
+ });
17
+ if (anchor.principalId !== config.principalId || anchor.workspace !== config.workspace
18
+ || anchor.agentPreset !== config.preset || anchor.authorityId !== config.ownerRouteId) {
19
+ throw new Error('assistant-growth-driver: owner route receipt does not match the configured scope');
20
+ }
21
+ const scope = Object.freeze({
22
+ principalId: config.principalId,
23
+ principalRecordId: anchor.principalRecordId,
24
+ principalVersion: anchor.principalVersion,
25
+ workspace: config.workspace,
26
+ preset: config.preset,
27
+ });
28
+ const anchorDigest = acceptanceDigest(anchor);
29
+ const id = `growth-${createHash('sha256')
30
+ .update(acceptanceDigest({ scope, ownerRouteId: config.ownerRouteId, expiresAt, anchorDigest }))
31
+ .digest('hex')
32
+ .slice(0, 40)}`;
33
+ return Object.freeze({
34
+ id,
35
+ scope,
36
+ ownerRouteId: config.ownerRouteId,
37
+ expiresAt,
38
+ assertCurrent() {
39
+ if (!Number.isSafeInteger(expiresAt) || expiresAt <= Date.now()) {
40
+ throw new Error('assistant-growth-driver: growth authority expired');
41
+ }
42
+ // Task-backed usage may continue across /new. Other wake protocols keep
43
+ // their exact binding fence. Neither path renews the original id or TTL.
44
+ const current = delivery.validateOwnerRoute({
45
+ authorityId: config.ownerRouteId,
46
+ principalId: config.principalId,
47
+ workspace: config.workspace,
48
+ agentPreset: config.preset,
49
+ });
50
+ if (allowNewSession ? !isSourceOwnerContinuation(current, anchor) : acceptanceDigest(current) !== anchorDigest) {
51
+ throw new Error('assistant-growth-driver: owner route changed during growth wake');
52
+ }
53
+ },
54
+ });
55
+ }
56
+ //# sourceMappingURL=deposit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deposit.js","sourceRoot":"","sources":["../src/deposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAkD9E;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA4B,EAAE,MAA8B,EAAE,SAAiB,EACjH,eAAe,GAAG,KAAK;IACvB,MAAM,MAAM,GAAG,QAAQ,CAAC,kBAAkB,CAAC;QACzC,WAAW,EAAE,MAAM,CAAC,YAAY;QAChC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,MAAM,CAAC,MAAM;KAC3B,CAAC,CAAA;IACF,IAAI,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;WACjF,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC;QACxF,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAA;IACrG,CAAC;IACD,MAAM,KAAK,GAAc,MAAM,CAAC,MAAM,CAAC;QACrC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAA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3
+ export interface ValidatedDreamIdeaInput {
4
+ readonly id: string;
5
+ readonly state: 'validated';
6
+ readonly lane: string;
7
+ readonly dayKey: string;
8
+ readonly createdAt: number;
9
+ readonly summary: string;
10
+ readonly detail: string;
11
+ readonly evidenceRefs: readonly string[];
12
+ readonly digest: string;
13
+ }
14
+ export interface DreamingIntakeSummary {
15
+ readonly enabled: boolean;
16
+ readonly considered: number;
17
+ readonly ingested: number;
18
+ readonly rejectedUnvalidated: number;
19
+ readonly ideaIds: readonly string[];
20
+ }
21
+ export interface ReadValidatedDreamIdeasResult {
22
+ readonly ideas: readonly ValidatedDreamIdeaInput[];
23
+ readonly summary: DreamingIntakeSummary;
24
+ }
25
+ /**
26
+ * Validate a candidate idea before admitting it into growth-driver prompt or
27
+ * wake context. Only strictly `state === 'validated'` ideas with bounded fields
28
+ * and digest-format evidence references are ever accepted.
29
+ */
30
+ export declare function assertValidatedDreamIdeaInput(value: unknown): ValidatedDreamIdeaInput;
31
+ /**
32
+ * Bounded, read-only ingestion of owner-validated dreaming ideas.
33
+ * Strictly ignores any idea that is not `state === 'validated'` (or lacks an
34
+ * owner validation audit event when `inspectIdeaEvents` is available).
35
+ */
36
+ export declare function readValidatedDreamIdeas(ctx: Context, authority: GrowthAuthority, maxIdeas: number): ReadValidatedDreamIdeasResult;
37
+ //# sourceMappingURL=dreaming-intake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dreaming-intake.d.ts","sourceRoot":"","sources":["../src/dreaming-intake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAOnD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,M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