@ftai/dsh-plugin-acn 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/README.md +31 -4
- package/README_EN.md +31 -4
- package/docs/architecture.md +1 -0
- package/docs/assets/acn-claim-reuse.png +0 -0
- package/docs/config.md +19 -9
- package/docs/development.md +4 -4
- package/docs/dsh-compat.md +2 -2
- package/docs/user_guide.md +3 -1
- package/lib/{activities-LRoCwpzw.js → activities-B8U-iW4-.js} +84 -4
- package/lib/{checkpoint-Bmt8q2vB.js → checkpoint-CPFPOxBM.js} +2 -2
- package/lib/{checkpoint-RgcdqifN.js → checkpoint-c7aI4D-X.js} +1 -1
- package/lib/client.js +220 -223
- package/lib/{deliver-BuYQaPRW.js → deliver-C-dmhkfm.js} +1 -1
- package/lib/{delivery-status-D5m3178s.js → delivery-status-M7-Rwoyj.js} +4 -2
- package/lib/{dream-agent-DBszTHXY.js → dream-agent-BVqxbKFc.js} +3 -3
- package/lib/dream.js +3 -3
- package/lib/{effects-DJ4Xa7Tx.js → effects-DX1iy6FM.js} +2 -2
- package/lib/{evidence-store-DLFvSuNa.js → evidence-store-DW7kj20i.js} +1 -1
- package/lib/{formation-replay-CEOy5FkI.js → formation-replay-Bf4TSBiz.js} +1 -1
- package/lib/formation.js +5 -5
- package/lib/history-DPMHX3ZE.js +214 -0
- package/lib/inbox.js +2 -2
- package/lib/index.js +43 -47
- package/lib/{paths-CDYV5UH9.js → paths-B7NI9Ano.js} +6 -3
- package/lib/plugins/commands.js +3 -3
- package/lib/plugins/dream.js +4 -4
- package/lib/plugins/formation.js +3 -3
- package/lib/plugins/inbox.js +3 -3
- package/lib/plugins/knowledge.js +21 -23
- package/lib/plugins/prompt.js +1 -1
- package/lib/plugins/tools.js +1 -1
- package/lib/{prepare-DwHZudbA.js → prepare-CGXwBEcu.js} +2 -2
- package/lib/{scheduler-MaUEbXr3.js → scheduler-BfJSY1eq.js} +1 -1
- package/lib/{service-C_i3BzdP.js → service-BPwaZzFF.js} +3 -3
- package/lib/{service-B7AI5jds.js → service-BQaszW_v.js} +1 -1
- package/lib/{service-BcHV5mc7.js → service-BhniAHLo.js} +5 -5
- package/lib/{service-CNjqHCBR.js → service-C2lXoygJ.js} +4 -4
- package/lib/session-binding-zCSuizHs.js +342 -0
- package/lib/store.js +1 -1
- package/lib/{structured-lyQCK-Zk.js → structured-C9byFuzm.js} +1 -0
- package/lib/team.js +1 -1
- package/lib/types/activities.d.ts +2 -0
- package/lib/types/client/ActivityCard.d.ts +14 -0
- package/lib/types/client/ActivityDetails.d.ts +1 -1
- package/lib/types/client/SourceSessionLink.d.ts +2 -1
- package/lib/types/client/TeamSettingsPage.d.ts +0 -2
- package/lib/types/client/interaction-styles.d.ts +1 -1
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/config.d.ts +1 -12
- package/lib/types/configuration.d.ts +0 -24
- package/lib/types/credentials.d.ts +0 -6
- package/lib/types/dsh-adapter/session-binding.d.ts +1 -1
- package/lib/types/interaction.d.ts +6 -15
- package/lib/types/store/delivery-status.d.ts +1 -0
- package/lib/types/store/history.d.ts +65 -0
- package/lib/types/store/library-directory.d.ts +4 -0
- package/lib/types/store/paths.d.ts +1 -1
- package/lib/upload.js +2 -2
- package/lib/{team-credentials-C9xHrPIi.js → upstreams-DEi-56tD.js} +164 -248
- package/lib/{worker-BBTYP2RE.js → worker-HMGzJFWd.js} +1 -1
- package/package.json +1 -1
- package/lib/presentation-BlLjgDjP.js +0 -47
- package/lib/session-binding-BQrOGhZI.js +0 -151
|
@@ -22,7 +22,8 @@ const DeliveryIssueSchema = z.object({
|
|
|
22
22
|
});
|
|
23
23
|
const Receipt = z.object({
|
|
24
24
|
version: z.string(),
|
|
25
|
-
target: z.string().regex(/^[0-9a-f]{64}$/)
|
|
25
|
+
target: z.string().regex(/^[0-9a-f]{64}$/),
|
|
26
|
+
updatedAt: z.number().int().nonnegative().optional()
|
|
26
27
|
});
|
|
27
28
|
const State = z.object({
|
|
28
29
|
schemaVersion: z.literal(1),
|
|
@@ -50,7 +51,8 @@ var DeliveryStatusStore = class {
|
|
|
50
51
|
const key = `${kind}-${id}`;
|
|
51
52
|
state.delivered[key] = {
|
|
52
53
|
version,
|
|
53
|
-
target: deliveryTarget(endpoint)
|
|
54
|
+
target: deliveryTarget(endpoint),
|
|
55
|
+
updatedAt: Date.now()
|
|
54
56
|
};
|
|
55
57
|
delete state.issues[key];
|
|
56
58
|
await writeYamlAtomic(this.context.paths.deliveryStatus, state, State, this.context.logger);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as transportError, t as abortable } from "./structured-
|
|
2
|
-
import { q as DreamValidationError } from "./evidence-store-
|
|
1
|
+
import { i as transportError, t as abortable } from "./structured-C9byFuzm.js";
|
|
2
|
+
import { q as DreamValidationError } from "./evidence-store-DW7kj20i.js";
|
|
3
3
|
import { _ as JobError } from "./lock-DbmlKOoX.js";
|
|
4
|
-
import { n as DreamTools, r as isDreamTool } from "./service-
|
|
4
|
+
import { n as DreamTools, r as isDreamTool } from "./service-BPwaZzFF.js";
|
|
5
5
|
import { t as toolParameters } from "./tool-schema-3b4gH1zf.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
package/lib/dream.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as OperationSchema, A as valueHash, B as CandidateSchema, C as expandDraft, D as sameIds, E as reviewInput, F as evidenceBody, G as DraftResponseSchema, H as CoverageSchema, I as independentReceipt, J as GroupSchema, K as DreamStateSchema, L as requireEvidenceIds, N as ReceiptSchema, O as validateCandidates, P as directEvidence, Q as KindSchema, S as contentHash, T as reaches, U as DiscoverySchema, V as CheckpointSchema, W as DraftGroupSchema, X as KeepReasonSchema, Y as HashSchema, Z as KeySchema, _ as dreamEligible, a as GlobArgs, at as ReviewInputSchema, b as validateSelfReview, c as privateDataHome, ct as ReviewSummarySchema, d as readEvidenceFile, dt as UpdateSchema, et as OriginSchema, f as receiptCurrent, ft as ValidationSchema, g as conservativeTokens, h as claimInput, i as EvidenceTools, it as QuoteSchema, k as validateConsolidationSources, l as authorizeFile, lt as SelfReviewSchema, m as INPUT_TOKENS, mt as text, n as EvidenceManifestSchema, nt as PreparedGroupSchema, o as GrepArgs, ot as ReviewRecordSchema, p as within, pt as requireDream, q as DreamValidationError, r as EvidenceStore, rt as ProgressSchema, s as ReadArgs, st as ReviewResponseSchema, t as ClaimArgs, tt as PlanSchema, u as discoverable, ut as SemanticReviewSchema, v as versions, w as prepareGroup, x as validateSemanticReview, y as coverageGaps, z as BasisSchema } from "./evidence-store-
|
|
2
|
-
import { t as DreamStore } from "./checkpoint-
|
|
3
|
-
import { a as SyncValidationSchema, i as DreamSync, t as AcnDream } from "./service-
|
|
1
|
+
import { $ as OperationSchema, A as valueHash, B as CandidateSchema, C as expandDraft, D as sameIds, E as reviewInput, F as evidenceBody, G as DraftResponseSchema, H as CoverageSchema, I as independentReceipt, J as GroupSchema, K as DreamStateSchema, L as requireEvidenceIds, N as ReceiptSchema, O as validateCandidates, P as directEvidence, Q as KindSchema, S as contentHash, T as reaches, U as DiscoverySchema, V as CheckpointSchema, W as DraftGroupSchema, X as KeepReasonSchema, Y as HashSchema, Z as KeySchema, _ as dreamEligible, a as GlobArgs, at as ReviewInputSchema, b as validateSelfReview, c as privateDataHome, ct as ReviewSummarySchema, d as readEvidenceFile, dt as UpdateSchema, et as OriginSchema, f as receiptCurrent, ft as ValidationSchema, g as conservativeTokens, h as claimInput, i as EvidenceTools, it as QuoteSchema, k as validateConsolidationSources, l as authorizeFile, lt as SelfReviewSchema, m as INPUT_TOKENS, mt as text, n as EvidenceManifestSchema, nt as PreparedGroupSchema, o as GrepArgs, ot as ReviewRecordSchema, p as within, pt as requireDream, q as DreamValidationError, r as EvidenceStore, rt as ProgressSchema, s as ReadArgs, st as ReviewResponseSchema, t as ClaimArgs, tt as PlanSchema, u as discoverable, ut as SemanticReviewSchema, v as versions, w as prepareGroup, x as validateSemanticReview, y as coverageGaps, z as BasisSchema } from "./evidence-store-DW7kj20i.js";
|
|
2
|
+
import { t as DreamStore } from "./checkpoint-c7aI4D-X.js";
|
|
3
|
+
import { a as SyncValidationSchema, i as DreamSync, t as AcnDream } from "./service-BPwaZzFF.js";
|
|
4
4
|
export { AcnDream, BasisSchema, CandidateSchema, CheckpointSchema, ClaimArgs, CoverageSchema, DiscoverySchema, DraftGroupSchema, DraftResponseSchema, DreamStateSchema, DreamStore, DreamSync, DreamValidationError, EvidenceManifestSchema, EvidenceStore, EvidenceTools, GlobArgs, GrepArgs, GroupSchema, HashSchema, INPUT_TOKENS, KeepReasonSchema, KeySchema, KindSchema, OperationSchema, OriginSchema, PlanSchema, PreparedGroupSchema, ProgressSchema, QuoteSchema, ReadArgs, ReceiptSchema, ReviewInputSchema, ReviewRecordSchema, ReviewResponseSchema, ReviewSummarySchema, SelfReviewSchema, SemanticReviewSchema, SyncValidationSchema, UpdateSchema, ValidationSchema, authorizeFile, claimInput, conservativeTokens, contentHash, coverageGaps, directEvidence, discoverable, dreamEligible, evidenceBody, expandDraft, independentReceipt, prepareGroup, privateDataHome, reaches, readEvidenceFile, receiptCurrent, requireDream, requireEvidenceIds, reviewInput, sameIds, text, validateCandidates, validateConsolidationSources, validateSelfReview, validateSemanticReview, valueHash, versions, within };
|
|
@@ -6,11 +6,11 @@ import { t as TraceSchema } from "./trace-Da0RnL5R.js";
|
|
|
6
6
|
import { t as TraceStore } from "./traces-CHBo8y1z.js";
|
|
7
7
|
import { t as DisputeSchema } from "./dispute-CtrInHzf.js";
|
|
8
8
|
import { r as UploadStore } from "./uploads-BCA2p92b.js";
|
|
9
|
-
import { t as DreamStore } from "./checkpoint-
|
|
9
|
+
import { t as DreamStore } from "./checkpoint-c7aI4D-X.js";
|
|
10
10
|
import { i as inboxEventAt, n as InboxMessageSchema } from "./inbox-DFtE2fOp.js";
|
|
11
11
|
import { n as ClaimEditStore, t as DisputeStore } from "./disputes-ByEmi43j.js";
|
|
12
12
|
import { t as InboxStore } from "./inbox-2CugZZQm.js";
|
|
13
|
-
import { n as FormationStore, r as newDisputes } from "./checkpoint-
|
|
13
|
+
import { n as FormationStore, r as newDisputes } from "./checkpoint-CPFPOxBM.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
16
16
|
import fs from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as timestampNanos, b as normalizeTimestamp, h as TraceIdSchema, i as effectiveUpdatedAt, l as ClaimIdSchema, m as SourceIdSchema, n as ClaimStatusSchema, r as ConfidenceSchema, t as ClaimSchema, x as nowSeconds, y as TimestampSchema } from "./claim-DOAGe8ZK.js";
|
|
2
|
-
import { u as FormationValidationError } from "./structured-
|
|
2
|
+
import { u as FormationValidationError } from "./structured-C9byFuzm.js";
|
|
3
3
|
import { n as claimRevision } from "./revision-DeoL_IUN.js";
|
|
4
4
|
import { n as validateClaimText, t as openSingleFile } from "./regular-file-BFpqMoub.js";
|
|
5
5
|
import { c as readYamlOr, l as writeYamlAtomic, n as withFileLock, w as hasCode } from "./lock-DbmlKOoX.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as JobError } from "./lock-DbmlKOoX.js";
|
|
2
|
-
import { d as sessionAllowed, l as restoreSessionBinding } from "./session-binding-
|
|
2
|
+
import { d as sessionAllowed, l as restoreSessionBinding } from "./session-binding-zCSuizHs.js";
|
|
3
3
|
import { n as projectEvent } from "./formation-D4LO31WW.js";
|
|
4
4
|
import { n as isSubagent } from "./subagent-yJsFxHmH.js";
|
|
5
5
|
import { SessionId, pluginRecordOf } from "@deepseek-ai/dsh-session";
|
package/lib/formation.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as FormationStateSchema, c as TranscriptStore, d as RecapOutputSchema, i as transportError, l as processedThrough, n as resolveRoute, o as RouteSchema, r as structuredCall, s as TranscriptEntrySchema, t as abortable, u as FormationValidationError } from "./structured-
|
|
1
|
+
import { a as FormationStateSchema, c as TranscriptStore, d as RecapOutputSchema, i as transportError, l as processedThrough, n as resolveRoute, o as RouteSchema, r as structuredCall, s as TranscriptEntrySchema, t as abortable, u as FormationValidationError } from "./structured-C9byFuzm.js";
|
|
2
2
|
import { _ as JobError, b as Preempted, g as DreamYield, h as DreamStopped, v as JobKindSchema, x as jobPriority, y as JobSchema } from "./lock-DbmlKOoX.js";
|
|
3
3
|
import { a as analysisIsStale, c as observeApplied, i as STALE_PLAN_WARNING, l as sameClaim, n as AnalysisReadBoundary, o as claimChanges, r as KnowledgeBusy, s as ensureKnowledgeReady, t as AnalysisChanged } from "./alignment-CwH0nBf-.js";
|
|
4
|
-
import { n as recapClaimIds, t as prepareFormation } from "./prepare-
|
|
5
|
-
import { n as FormationStore, t as CheckpointSchema } from "./checkpoint-
|
|
4
|
+
import { n as recapClaimIds, t as prepareFormation } from "./prepare-CGXwBEcu.js";
|
|
5
|
+
import { n as FormationStore, t as CheckpointSchema } from "./checkpoint-CPFPOxBM.js";
|
|
6
6
|
import { n as runnableJob, t as JobQueue } from "./queue-M917xHPS.js";
|
|
7
|
-
import { t as DurableWorker } from "./worker-
|
|
8
|
-
import { t as AcnFormation } from "./service-
|
|
7
|
+
import { t as DurableWorker } from "./worker-HMGzJFWd.js";
|
|
8
|
+
import { t as AcnFormation } from "./service-C2lXoygJ.js";
|
|
9
9
|
export { AcnFormation, AnalysisChanged, AnalysisReadBoundary, CheckpointSchema, DreamStopped, DreamYield, DurableWorker, FormationStateSchema, FormationStore, FormationValidationError, JobError, JobKindSchema, JobQueue, JobSchema, KnowledgeBusy, Preempted, RecapOutputSchema, RouteSchema, STALE_PLAN_WARNING, TranscriptEntrySchema, TranscriptStore, abortable, analysisIsStale, claimChanges, ensureKnowledgeReady, jobPriority, observeApplied, prepareFormation, processedThrough, recapClaimIds, resolveRoute, runnableJob, sameClaim, structuredCall, transportError };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { o as optional, t as ClaimSchema } from "./claim-DOAGe8ZK.js";
|
|
2
|
+
import { c as readYamlOr, l as writeYamlAtomic, n as withFileLock, w as hasCode } from "./lock-DbmlKOoX.js";
|
|
3
|
+
import { t as TraceSchema } from "./trace-Da0RnL5R.js";
|
|
4
|
+
import { t as DisputeSchema } from "./dispute-CtrInHzf.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import { basename, dirname, join } from "node:path";
|
|
8
|
+
import { parse } from "yaml";
|
|
9
|
+
//#region src/store/presentation.ts
|
|
10
|
+
const Schema = z.object({
|
|
11
|
+
schemaVersion: z.literal(1),
|
|
12
|
+
baselineAt: z.number(),
|
|
13
|
+
seen: z.record(z.string(), z.number())
|
|
14
|
+
});
|
|
15
|
+
var PresentationStore = class {
|
|
16
|
+
context;
|
|
17
|
+
path;
|
|
18
|
+
constructor(context) {
|
|
19
|
+
this.context = context;
|
|
20
|
+
this.path = join(context.paths.root, "presentation.yaml");
|
|
21
|
+
}
|
|
22
|
+
read() {
|
|
23
|
+
return readYamlOr(this.path, Schema, () => null);
|
|
24
|
+
}
|
|
25
|
+
async initialize() {
|
|
26
|
+
await withFileLock(`${this.path}.lock`, async () => {
|
|
27
|
+
if (await this.read() === null) await writeYamlAtomic(this.path, {
|
|
28
|
+
schemaVersion: 1,
|
|
29
|
+
baselineAt: Date.now(),
|
|
30
|
+
seen: {}
|
|
31
|
+
}, Schema, this.context.logger);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async acknowledge(id, version) {
|
|
35
|
+
await withFileLock(`${this.path}.lock`, async () => {
|
|
36
|
+
const current = await this.read() ?? {
|
|
37
|
+
schemaVersion: 1,
|
|
38
|
+
baselineAt: Date.now(),
|
|
39
|
+
seen: {}
|
|
40
|
+
};
|
|
41
|
+
await writeYamlAtomic(this.path, {
|
|
42
|
+
...current,
|
|
43
|
+
seen: {
|
|
44
|
+
...current.seen,
|
|
45
|
+
[id]: Math.max(version, current.seen[id] ?? 0)
|
|
46
|
+
}
|
|
47
|
+
}, Schema, this.context.logger);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/store/history.ts
|
|
53
|
+
const Session = z.string().regex(/^[a-zA-Z0-9_-]+$/);
|
|
54
|
+
const Application = z.object({
|
|
55
|
+
schema_version: z.literal(1),
|
|
56
|
+
state: z.enum([
|
|
57
|
+
"prepared",
|
|
58
|
+
"applied",
|
|
59
|
+
"cancelled"
|
|
60
|
+
]),
|
|
61
|
+
application: z.object({
|
|
62
|
+
id: z.string().uuid(),
|
|
63
|
+
agent: z.string(),
|
|
64
|
+
knowledge: z.object({
|
|
65
|
+
claims: z.array(ClaimSchema),
|
|
66
|
+
disputes: z.array(DisputeSchema)
|
|
67
|
+
}),
|
|
68
|
+
trace: optional(TraceSchema)
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
const Journal = z.object({
|
|
72
|
+
schemaVersion: z.literal(1),
|
|
73
|
+
scope: z.object({
|
|
74
|
+
upstreamId: z.string(),
|
|
75
|
+
sessionId: Session
|
|
76
|
+
}),
|
|
77
|
+
jobs: z.array(z.object({
|
|
78
|
+
id: z.string().uuid(),
|
|
79
|
+
applicationId: z.string().uuid().nullable(),
|
|
80
|
+
work: z.object({ agentId: z.string() }).nullable(),
|
|
81
|
+
trigger: z.string(),
|
|
82
|
+
attempts: z.number().int().nonnegative(),
|
|
83
|
+
queuedAtMicros: z.number().nonnegative()
|
|
84
|
+
})),
|
|
85
|
+
presentationTimes: z.record(z.string(), z.number().nonnegative()).default({})
|
|
86
|
+
});
|
|
87
|
+
const Entity = z.discriminatedUnion("kind", [z.object({
|
|
88
|
+
kind: z.literal("claim"),
|
|
89
|
+
value: ClaimSchema
|
|
90
|
+
}), z.object({
|
|
91
|
+
kind: z.literal("dispute"),
|
|
92
|
+
value: DisputeSchema
|
|
93
|
+
})]);
|
|
94
|
+
const Ledger = z.object({
|
|
95
|
+
schemaVersion: z.literal(1),
|
|
96
|
+
scope: z.object({
|
|
97
|
+
upstream: z.string(),
|
|
98
|
+
agent: z.string()
|
|
99
|
+
}),
|
|
100
|
+
batches: z.array(z.object({
|
|
101
|
+
applicationId: z.string().uuid(),
|
|
102
|
+
owner: z.object({ sourceSession: Session }),
|
|
103
|
+
items: z.array(z.object({
|
|
104
|
+
entity: Entity,
|
|
105
|
+
state: z.string(),
|
|
106
|
+
lastConnectionRevision: optional(z.string()),
|
|
107
|
+
presentationAtMicros: z.number().nonnegative().default(0)
|
|
108
|
+
}))
|
|
109
|
+
}))
|
|
110
|
+
});
|
|
111
|
+
const ConnectionIndex = z.object({ upstreams: z.array(z.object({
|
|
112
|
+
summary: z.object({
|
|
113
|
+
id: z.string(),
|
|
114
|
+
agentId: z.string(),
|
|
115
|
+
maintainerEndpoint: z.string()
|
|
116
|
+
}),
|
|
117
|
+
maintainerRevision: z.string().optional()
|
|
118
|
+
})) });
|
|
119
|
+
async function documents(directory, schema, context) {
|
|
120
|
+
let names;
|
|
121
|
+
try {
|
|
122
|
+
names = await fs.readdir(directory);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (hasCode(error, "ENOENT")) return [];
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
const result = [];
|
|
128
|
+
for (const name of names.sort()) {
|
|
129
|
+
if (!name.endsWith(".yaml") || name.includes(".tmp.")) continue;
|
|
130
|
+
try {
|
|
131
|
+
const value = schema.safeParse(parse(await fs.readFile(join(directory, name), "utf8")));
|
|
132
|
+
if (value.success) result.push(value.data);
|
|
133
|
+
else context.logger.warn("Skipped an invalid historical knowledge record.");
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (hasCode(error, "ENOENT")) continue;
|
|
136
|
+
context.logger.warn("Could not read a historical knowledge record.");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
async function historicalKnowledge(context) {
|
|
142
|
+
const result = {
|
|
143
|
+
applications: [],
|
|
144
|
+
sources: /* @__PURE__ */ new Map(),
|
|
145
|
+
deliveries: []
|
|
146
|
+
};
|
|
147
|
+
const upstreamRoot = dirname(dirname(context.paths.root));
|
|
148
|
+
const upstreamId = basename(upstreamRoot);
|
|
149
|
+
const add = (ids, session) => {
|
|
150
|
+
for (const id of ids) {
|
|
151
|
+
const sessions = result.sources.get(id) ?? /* @__PURE__ */ new Set();
|
|
152
|
+
sessions.add(session);
|
|
153
|
+
result.sources.set(id, sessions);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const origins = /* @__PURE__ */ new Map();
|
|
157
|
+
for (const journal of await documents(join(upstreamRoot, "supervisor", "journals"), Journal, context)) {
|
|
158
|
+
if (journal.scope.upstreamId !== upstreamId) continue;
|
|
159
|
+
for (const job of journal.jobs) if (job.applicationId !== null && job.work?.agentId === context.agentId) origins.set(job.applicationId, {
|
|
160
|
+
sessionId: journal.scope.sessionId,
|
|
161
|
+
trigger: job.trigger,
|
|
162
|
+
attempts: job.attempts,
|
|
163
|
+
updatedAt: (journal.presentationTimes[job.id] ?? job.queuedAtMicros) / 1e3
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
for (const record of await documents(join(context.paths.root, "applications"), Application, context)) {
|
|
167
|
+
const { application } = record;
|
|
168
|
+
if (application.agent !== context.agentId || application.knowledge.claims.some((claim) => claim.holder !== context.agentId) || application.knowledge.disputes.some((dispute) => dispute.reporter_agent_id !== context.agentId) || application.trace && application.trace.agent !== context.agentId) continue;
|
|
169
|
+
const origin = origins.get(application.id);
|
|
170
|
+
const entityIds = [
|
|
171
|
+
...application.knowledge.claims.map((item) => item.id),
|
|
172
|
+
...application.knowledge.disputes.map((item) => item.id),
|
|
173
|
+
...application.trace ? [application.trace.id] : []
|
|
174
|
+
];
|
|
175
|
+
const times = [
|
|
176
|
+
...application.knowledge.claims.map((item) => item.updated_at ?? item.created_at),
|
|
177
|
+
...application.knowledge.disputes.map((item) => item.created_at),
|
|
178
|
+
...application.trace ? [application.trace.created_at] : []
|
|
179
|
+
].map(Date.parse);
|
|
180
|
+
result.applications.push({
|
|
181
|
+
id: application.id,
|
|
182
|
+
state: record.state,
|
|
183
|
+
kind: origin?.trigger === "archive" ? "finalize" : origin === void 0 ? "history" : "recap",
|
|
184
|
+
attempts: origin?.attempts ?? 0,
|
|
185
|
+
updatedAt: origin?.updatedAt ?? Math.max(0, ...times),
|
|
186
|
+
entityIds,
|
|
187
|
+
claimCount: application.knowledge.claims.length,
|
|
188
|
+
disputeCount: application.knowledge.disputes.length,
|
|
189
|
+
traceCount: Number(application.trace !== void 0),
|
|
190
|
+
...origin === void 0 ? {} : { sessionId: origin.sessionId }
|
|
191
|
+
});
|
|
192
|
+
if (origin !== void 0 && record.state === "applied") add(entityIds, origin.sessionId);
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const connection = ConnectionIndex.parse(JSON.parse(await fs.readFile(join(dirname(dirname(upstreamRoot)), "settings.json"), "utf8"))).upstreams.find((entry) => entry.summary.id === upstreamId && entry.summary.agentId === context.agentId);
|
|
196
|
+
const ledger = Ledger.parse(parse(await fs.readFile(join(context.paths.uploads, "ledger.yaml"), "utf8")));
|
|
197
|
+
if (ledger.scope.upstream !== upstreamId || ledger.scope.agent !== context.agentId) return result;
|
|
198
|
+
for (const batch of ledger.batches) for (const item of batch.items) {
|
|
199
|
+
if (!(item.entity.kind === "claim" ? item.entity.value.holder === context.agentId : item.entity.value.reporter_agent_id === context.agentId)) continue;
|
|
200
|
+
add([item.entity.value.id], batch.owner.sourceSession);
|
|
201
|
+
if (item.state === "delivered" && connection !== void 0 && connection.maintainerRevision !== void 0 && item.lastConnectionRevision === connection.maintainerRevision && connection.summary.maintainerEndpoint) result.deliveries.push({
|
|
202
|
+
entity: item.entity,
|
|
203
|
+
endpoint: connection.summary.maintainerEndpoint,
|
|
204
|
+
updatedAt: item.presentationAtMicros / 1e3,
|
|
205
|
+
sessionId: batch.owner.sourceSession
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if (!hasCode(error, "ENOENT")) context.logger.warn("Could not read historical delivery acknowledgements.");
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { PresentationStore as n, historicalKnowledge as t };
|
package/lib/inbox.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as inboxContext, i as InternalizeOutputSchema, n as syncInbox, o as prepareInbox, r as deprecatePolicyClaims, s as validateArbitration, t as AcnInbox } from "./service-
|
|
2
|
-
import { n as InboxEffectStore, r as inboxMessageHash, t as InboxEffectSchema } from "./effects-
|
|
1
|
+
import { a as inboxContext, i as InternalizeOutputSchema, n as syncInbox, o as prepareInbox, r as deprecatePolicyClaims, s as validateArbitration, t as AcnInbox } from "./service-BhniAHLo.js";
|
|
2
|
+
import { n as InboxEffectStore, r as inboxMessageHash, t as InboxEffectSchema } from "./effects-DX1iy6FM.js";
|
|
3
3
|
export { AcnInbox, InboxEffectSchema, InboxEffectStore, InternalizeOutputSchema, deprecatePolicyClaims, inboxContext, inboxMessageHash, prepareInbox, syncInbox, validateArbitration };
|
package/lib/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { S as timestampNanos, h as TraceIdSchema, i as effectiveUpdatedAt, l as ClaimIdSchema } from "./claim-DOAGe8ZK.js";
|
|
2
|
-
import { c as TranscriptStore } from "./structured-
|
|
1
|
+
import { S as timestampNanos, h as TraceIdSchema, i as effectiveUpdatedAt, l as ClaimIdSchema, u as DisputeIdSchema } from "./claim-DOAGe8ZK.js";
|
|
2
|
+
import { c as TranscriptStore } from "./structured-C9byFuzm.js";
|
|
3
3
|
import { n as claimRevision } from "./revision-DeoL_IUN.js";
|
|
4
|
-
import { _ as JobError, c as readYamlOr
|
|
4
|
+
import { _ as JobError, c as readYamlOr } from "./lock-DbmlKOoX.js";
|
|
5
5
|
import { i as ClaimStore } from "./reported-sets-DdEKdeVb.js";
|
|
6
6
|
import { t as TraceStore } from "./traces-CHBo8y1z.js";
|
|
7
7
|
import { a as disputeVersion, n as PendingUploadsSchema, r as UploadStore } from "./uploads-BCA2p92b.js";
|
|
8
|
-
import { t as DreamStore } from "./checkpoint-
|
|
9
|
-
import { n as deliveryTarget, t as DeliveryStatusStore } from "./delivery-status-
|
|
8
|
+
import { t as DreamStore } from "./checkpoint-c7aI4D-X.js";
|
|
9
|
+
import { n as deliveryTarget, t as DeliveryStatusStore } from "./delivery-status-M7-Rwoyj.js";
|
|
10
10
|
import { t as TeamError } from "./errors-pPumDOGD.js";
|
|
11
|
-
import { t as UploadDelivery } from "./deliver-
|
|
12
|
-
import {
|
|
13
|
-
import { r as
|
|
11
|
+
import { t as UploadDelivery } from "./deliver-C-dmhkfm.js";
|
|
12
|
+
import { C as resolveConfig, S as activeUpstream, b as UpstreamNameSchema, r as configurationBusy, u as runningConfiguration, v as ConfigError, w as upstreamsOf, x as UpstreamSchema, y as ConnectionSchema } from "./session-binding-zCSuizHs.js";
|
|
13
|
+
import { n as agentHomePath, o as invalidStorageName, r as expandHomePath, t as AgentPaths } from "./paths-B7NI9Ano.js";
|
|
14
14
|
import { t as DisputeStore } from "./disputes-ByEmi43j.js";
|
|
15
|
-
import { n as FormationStore } from "./checkpoint-
|
|
16
|
-
import { t as TeamFacade } from "./service-
|
|
15
|
+
import { n as FormationStore } from "./checkpoint-CPFPOxBM.js";
|
|
16
|
+
import { t as TeamFacade } from "./service-BQaszW_v.js";
|
|
17
17
|
import { t as JobQueue } from "./queue-M917xHPS.js";
|
|
18
|
-
import {
|
|
19
|
-
import { a as
|
|
20
|
-
import {
|
|
18
|
+
import { a as messageInfo, n as allActivities, r as MessageInfoSchema, t as activityPage } from "./activities-B8U-iW4-.js";
|
|
19
|
+
import { a as teamCredentials, i as credentialReference, o as AcnKnowledge, r as resolveUpstream, s as prepareLibraryDirectory } from "./upstreams-DEi-56tD.js";
|
|
20
|
+
import { n as PresentationStore, t as historicalKnowledge } from "./history-DPMHX3ZE.js";
|
|
21
21
|
import { z } from "zod";
|
|
22
22
|
import { createHash } from "node:crypto";
|
|
23
23
|
import { access, stat } from "node:fs/promises";
|
|
24
|
-
import { dirname,
|
|
24
|
+
import { dirname, resolve } from "node:path";
|
|
25
25
|
import { constants } from "node:fs";
|
|
26
26
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
27
27
|
import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
@@ -135,14 +135,6 @@ function record(value) {
|
|
|
135
135
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
136
136
|
}
|
|
137
137
|
function mergeConfiguration(raw, values) {
|
|
138
|
-
if (values.upstreams !== void 0) {
|
|
139
|
-
const previous = upstreamsOf(resolveConfig(raw));
|
|
140
|
-
for (const [key, value] of Object.entries(values.upstreams)) if (value.legacyStorage !== previous[key]?.legacyStorage || value.legacyKey !== previous[key]?.legacyKey) throw new ConfigError([
|
|
141
|
-
"upstreams",
|
|
142
|
-
key,
|
|
143
|
-
"legacyStorage"
|
|
144
|
-
]);
|
|
145
|
-
}
|
|
146
138
|
const next = {
|
|
147
139
|
...raw,
|
|
148
140
|
agentId: values.agentId,
|
|
@@ -278,6 +270,11 @@ const ActivitySchema = z.object({
|
|
|
278
270
|
claimIds: z.array(ClaimIdSchema),
|
|
279
271
|
reason: z.string()
|
|
280
272
|
})).optional(),
|
|
273
|
+
entityIds: z.array(z.union([
|
|
274
|
+
ClaimIdSchema,
|
|
275
|
+
DisputeIdSchema,
|
|
276
|
+
TraceIdSchema
|
|
277
|
+
])).optional(),
|
|
281
278
|
entityId: z.string().optional(),
|
|
282
279
|
retryable: z.boolean().optional(),
|
|
283
280
|
acknowledged: z.boolean().optional(),
|
|
@@ -302,7 +299,11 @@ const KnowledgeViewSchema = z.object({
|
|
|
302
299
|
pendingClaims: z.number(),
|
|
303
300
|
pendingDisputes: z.number()
|
|
304
301
|
});
|
|
305
|
-
const ReferenceIdSchema = z.union([
|
|
302
|
+
const ReferenceIdSchema = z.union([
|
|
303
|
+
ClaimIdSchema,
|
|
304
|
+
DisputeIdSchema,
|
|
305
|
+
TraceIdSchema
|
|
306
|
+
]);
|
|
306
307
|
const KnowledgeReferenceSchema = z.object({
|
|
307
308
|
key: z.string(),
|
|
308
309
|
id: ReferenceIdSchema,
|
|
@@ -546,6 +547,7 @@ async function knowledgeSources(context, entityIds) {
|
|
|
546
547
|
}
|
|
547
548
|
};
|
|
548
549
|
if (wanted.size === 0) return /* @__PURE__ */ new Map();
|
|
550
|
+
for (const [id, sessions] of (await historicalKnowledge(context)).sources) for (const session of sessions) add([id], session);
|
|
549
551
|
const formation = new FormationStore(context);
|
|
550
552
|
for (const session of await new TranscriptStore(context).sessions()) try {
|
|
551
553
|
const record = await formation.read(session);
|
|
@@ -712,12 +714,14 @@ async function readKnowledge(pool, key, kind, query, offset, entities = true, ac
|
|
|
712
714
|
const pending = await new UploadStore(context).read();
|
|
713
715
|
const pendingIds = new Set([...pending.claims, ...pending.disputes].map((item) => item.id));
|
|
714
716
|
const delivered = (await new DeliveryStatusStore(context).read()).delivered;
|
|
717
|
+
const historical = (await historicalKnowledge(context)).deliveries;
|
|
715
718
|
const target = knowledge.team === null ? "" : deliveryTarget(config.team.maintainerEndpoint);
|
|
716
719
|
const delivery = (item) => {
|
|
717
720
|
if (pendingIds.has(item.id)) return "pending";
|
|
718
721
|
const receipt = delivered[`${kind}-${item.id}`];
|
|
719
722
|
const version = "statement" in item ? claimRevision(item) : "reporter_agent_id" in item ? disputeVersion(item) : "";
|
|
720
|
-
|
|
723
|
+
const oldReceipt = historical.some((record) => record.entity.value.id === item.id && record.entity.kind === kind && deliveryTarget(record.endpoint) === target && (record.entity.kind === "claim" ? claimRevision(record.entity.value) : disputeVersion(record.entity.value)) === version);
|
|
724
|
+
return target !== "" && (receipt?.target === target && receipt.version === version || oldReceipt) ? "synced" : "local";
|
|
721
725
|
};
|
|
722
726
|
const text = query.toLocaleLowerCase();
|
|
723
727
|
const matching = values.filter((item) => ("holder" in item ? item.holder === context.agentId : "agent" in item ? item.agent === context.agentId : item.reporter_agent_id === context.agentId) && JSON.stringify(item).toLocaleLowerCase().includes(text) && (!filters.status || "status" in item && item.status === filters.status) && (!filters.delivery || filters.delivery === "all" || delivery(item) === filters.delivery)).sort(compareKnowledge);
|
|
@@ -857,8 +861,8 @@ async function executeInteraction(ctx, input, runtimePool, signal) {
|
|
|
857
861
|
if (config === void 0 || !config.agentId) throw new JobError("connection", "请选择可用的知识身份。");
|
|
858
862
|
const knowledge = pool.isBase(request.key) ? pool.base : new AcnKnowledge(config, ctx.logger);
|
|
859
863
|
try {
|
|
860
|
-
const
|
|
861
|
-
const item = (trace ? await new TraceStore(knowledge.context()).list() : await new ClaimStore(knowledge.context()).list()).find((value) => value.id === request.id && ("holder" in value ? value.holder : value.agent) === knowledge.agentId);
|
|
864
|
+
const kind = request.id.startsWith("trace_") ? "trace" : request.id.startsWith("dispute_") ? "dispute" : "claim";
|
|
865
|
+
const item = (kind === "trace" ? await new TraceStore(knowledge.context()).list() : kind === "dispute" ? await new DisputeStore(knowledge.context()).list() : await new ClaimStore(knowledge.context()).list()).find((value) => value.id === request.id && ("holder" in value ? value.holder : "agent" in value ? value.agent : value.reporter_agent_id) === knowledge.agentId);
|
|
862
866
|
const origins = item === void 0 ? [] : (await knowledgeSources(knowledge.context(), [item.id])).get(item.id) ?? [];
|
|
863
867
|
const sources = await Promise.all(origins.map((id) => sourceSession(ctx, id, signal)));
|
|
864
868
|
return {
|
|
@@ -868,7 +872,7 @@ async function executeInteraction(ctx, input, runtimePool, signal) {
|
|
|
868
872
|
key: request.key,
|
|
869
873
|
id: request.id,
|
|
870
874
|
...item === void 0 ? {} : { item: {
|
|
871
|
-
kind
|
|
875
|
+
kind,
|
|
872
876
|
id: item.id,
|
|
873
877
|
name: item.name,
|
|
874
878
|
status: "status" in item ? String(item.status) : "",
|
|
@@ -1202,13 +1206,14 @@ var ConfigurationService = class extends TypertRemoteService {
|
|
|
1202
1206
|
const models = await this.models();
|
|
1203
1207
|
const entry = this.entry();
|
|
1204
1208
|
const raw = entryConfig(entry);
|
|
1205
|
-
const
|
|
1206
|
-
const
|
|
1209
|
+
const effective = await prepareLibraryDirectory(raw, raw);
|
|
1210
|
+
const values = configurationValues(effective);
|
|
1211
|
+
const config = resolveConfig(effective);
|
|
1207
1212
|
const upstreamPending = {};
|
|
1208
1213
|
for (const key of Object.keys(upstreamsOf(config))) try {
|
|
1209
1214
|
const selected = resolveUpstream(config, key, true);
|
|
1210
1215
|
if (selected === void 0) continue;
|
|
1211
|
-
const path = new AgentPaths(agentHomePath(selected.home, selected.agentId)).pendingUploads;
|
|
1216
|
+
const path = new AgentPaths(agentHomePath(selected.home, selected.agentId, activeUpstream(selected))).pendingUploads;
|
|
1212
1217
|
const pending = await readYamlOr(path, PendingUploadsSchema, () => PendingUploadsSchema.parse({}));
|
|
1213
1218
|
upstreamPending[key] = pending.claims.length + pending.disputes.length + (pending.consolidations?.length ?? 0) + (pending.acknowledgements?.length ?? 0);
|
|
1214
1219
|
} catch {
|
|
@@ -1218,7 +1223,7 @@ var ConfigurationService = class extends TypertRemoteService {
|
|
|
1218
1223
|
let dataDirectory = "";
|
|
1219
1224
|
try {
|
|
1220
1225
|
const selected = config.upstreams === void 0 ? config : resolveUpstream(config, config.upstream);
|
|
1221
|
-
dataDirectory = selected?.agentId ? agentHomePath(selected.home, selected.agentId) : "";
|
|
1226
|
+
dataDirectory = selected?.agentId ? agentHomePath(selected.home, selected.agentId, activeUpstream(selected)) : "";
|
|
1222
1227
|
} catch {
|
|
1223
1228
|
this.ctx.logger.warn("Could not resolve the selected data directory; configuration remains available.");
|
|
1224
1229
|
}
|
|
@@ -1253,27 +1258,18 @@ var ConfigurationService = class extends TypertRemoteService {
|
|
|
1253
1258
|
if (values.upstreams === void 0 && values.agentId === "") throw new ConfigError(["agentId"]);
|
|
1254
1259
|
if (values.mode === "team" && (!values.routerEndpoint || !values.maintainerEndpoint)) throw new ConfigError(["team"]);
|
|
1255
1260
|
const previous = configurationValues(entryConfig(entry));
|
|
1256
|
-
const
|
|
1261
|
+
const prepared = await prepareLibraryDirectory(entryConfig(entry), mergeConfiguration(entryConfig(entry), values));
|
|
1262
|
+
const candidate = resolveConfig(prepared);
|
|
1257
1263
|
const enabled = Object.entries(upstreamsOf(candidate)).filter(([, item]) => item.enabled);
|
|
1258
|
-
if (enabled.
|
|
1259
|
-
key,
|
|
1260
|
-
item.agentId,
|
|
1261
|
-
item.legacyKey ?? ""
|
|
1262
|
-
]).some((name) => invalidStorageName(name))) return {
|
|
1264
|
+
if (enabled.map(([key]) => key).some((name) => invalidStorageName(name))) return {
|
|
1263
1265
|
ok: false,
|
|
1264
1266
|
code: "invalid",
|
|
1265
1267
|
fields: ["windowsStorageName"]
|
|
1266
1268
|
};
|
|
1267
|
-
await checkDirectory(
|
|
1269
|
+
await checkDirectory(expandHomePath(candidate.home));
|
|
1268
1270
|
for (const [key] of enabled) {
|
|
1269
1271
|
const selected = resolveUpstream(candidate, key);
|
|
1270
|
-
if (selected !== void 0) await checkDirectory(agentHomePath(selected.home, selected.agentId));
|
|
1271
|
-
}
|
|
1272
|
-
if (values.upstreams !== void 0 && previous.upstreams === void 0 && (previous.agentId !== "" || (previous.connections?.length ?? 0) > 0)) {
|
|
1273
|
-
const backup = join(dirname(dirname(agentHomePath(previous.home, "example"))), "upstream-migration-v1.yaml");
|
|
1274
|
-
await withFileLock(`${backup}.lock`, async () => {
|
|
1275
|
-
if (await readYamlOr(backup, z.unknown(), () => null) === null) await writeYamlAtomic(backup, entryConfig(entry), z.unknown(), this.ctx.logger);
|
|
1276
|
-
});
|
|
1272
|
+
if (selected !== void 0) await checkDirectory(agentHomePath(selected.home, selected.agentId, activeUpstream(selected)));
|
|
1277
1273
|
}
|
|
1278
1274
|
if (values.provider !== "" && !(await this.models()).some((model) => model.provider === values.provider && model.id === values.model)) return {
|
|
1279
1275
|
ok: false,
|
|
@@ -1283,7 +1279,7 @@ var ConfigurationService = class extends TypertRemoteService {
|
|
|
1283
1279
|
this.checkIdle();
|
|
1284
1280
|
this.pending += 1;
|
|
1285
1281
|
let conflict = false;
|
|
1286
|
-
const identity = (value) => value.upstreams !== void 0 || value.agentId === "" ? "" : agentHomePath(value.home, value.agentId);
|
|
1282
|
+
const identity = (value) => value.upstreams !== void 0 || value.agentId === "" ? "" : agentHomePath(value.home, value.agentId, value.upstream || "personal");
|
|
1287
1283
|
const epoch = () => Math.max(Date.now(), ...this.ctx.agents.list().map((agent) => agent.session.header.createdAt));
|
|
1288
1284
|
try {
|
|
1289
1285
|
await this.ctx.configEditor.edit(entry, (current) => {
|
|
@@ -1296,7 +1292,7 @@ var ConfigurationService = class extends TypertRemoteService {
|
|
|
1296
1292
|
};
|
|
1297
1293
|
}
|
|
1298
1294
|
this.checkIdle();
|
|
1299
|
-
const next =
|
|
1295
|
+
const next = { ...prepared };
|
|
1300
1296
|
this.protectCredentials(next);
|
|
1301
1297
|
if (values.upstreams === void 0 && identity(previous) !== identity(values)) next.sessionEpoch = epoch();
|
|
1302
1298
|
return next;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as AgentIdSchema, d as InboxIdSchema, h as TraceIdSchema, l as ClaimIdSchema, u as DisputeIdSchema } from "./claim-DOAGe8ZK.js";
|
|
2
2
|
import { C as StoreError } from "./lock-DbmlKOoX.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
3
4
|
import { join, resolve } from "node:path";
|
|
4
5
|
import { homedir } from "node:os";
|
|
5
6
|
//#region src/local-name.ts
|
|
@@ -19,10 +20,12 @@ function assertStorageName(name) {
|
|
|
19
20
|
function expandHomePath(home) {
|
|
20
21
|
return home === "~" ? homedir() : /^~[/\\]/.test(home) ? join(homedir(), home.slice(2)) : home;
|
|
21
22
|
}
|
|
22
|
-
function agentHomePath(home, agentId) {
|
|
23
|
+
function agentHomePath(home, agentId, upstream = "personal") {
|
|
23
24
|
const id = AgentIdSchema.parse(agentId);
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
if (!/^[a-z0-9_-]+$/.test(upstream)) throw new Error("Invalid upstream identifier.");
|
|
26
|
+
assertStorageName(upstream);
|
|
27
|
+
const directory = createHash("sha256").update("agent").update(Uint8Array.of(0)).update(id).digest("hex");
|
|
28
|
+
return join(resolve(expandHomePath(home)), "upstreams", upstream, "agents", directory);
|
|
26
29
|
}
|
|
27
30
|
function safeKey(value) {
|
|
28
31
|
if (!/^[a-zA-Z0-9_-]+$/.test(value)) throw new Error("Invalid local document identifier.");
|
package/lib/plugins/commands.js
CHANGED
|
@@ -4,11 +4,11 @@ import { n as validateClaimText, t as openSingleFile } from "../regular-file-BFp
|
|
|
4
4
|
import { _ as JobError, i as decodeYaml, n as withFileLock, p as writeTextAtomicIfAbsent, w as hasCode } from "../lock-DbmlKOoX.js";
|
|
5
5
|
import { t as TraceSchema } from "../trace-Da0RnL5R.js";
|
|
6
6
|
import { r as UploadStore } from "../uploads-BCA2p92b.js";
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
7
|
+
import { _ as unboundSession, f as sessionChanged, r as configurationBusy } from "../session-binding-zCSuizHs.js";
|
|
8
|
+
import { r as expandHomePath } from "../paths-B7NI9Ano.js";
|
|
9
9
|
import { n as isSubagent } from "../subagent-yJsFxHmH.js";
|
|
10
10
|
import { t as JobQueue } from "../queue-M917xHPS.js";
|
|
11
|
-
import { i as commandMessage, n as allActivities } from "../activities-
|
|
11
|
+
import { i as commandMessage, n as allActivities } from "../activities-B8U-iW4-.js";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
import fs from "node:fs/promises";
|
|
14
14
|
import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
|
package/lib/plugins/dream.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as RouteSchema } from "../structured-
|
|
1
|
+
import { o as RouteSchema } from "../structured-C9byFuzm.js";
|
|
2
2
|
import { c as readYamlOr, l as writeYamlAtomic, n as withFileLock } from "../lock-DbmlKOoX.js";
|
|
3
|
-
import { t as AcnDream } from "../service-
|
|
4
|
-
import { d as sessionAllowed } from "../session-binding-
|
|
3
|
+
import { t as AcnDream } from "../service-BPwaZzFF.js";
|
|
4
|
+
import { d as sessionAllowed } from "../session-binding-zCSuizHs.js";
|
|
5
5
|
import { n as projectEvent, r as structuredBackend } from "../formation-D4LO31WW.js";
|
|
6
|
-
import { t as autonomousDreamRunner } from "../dream-agent-
|
|
6
|
+
import { t as autonomousDreamRunner } from "../dream-agent-BVqxbKFc.js";
|
|
7
7
|
import { t as loadPromptRenderer } from "../render-CJaVcKKC.js";
|
|
8
8
|
import { n as isSubagent } from "../subagent-yJsFxHmH.js";
|
|
9
9
|
import { z } from "zod";
|
package/lib/plugins/formation.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as sessionAllowed } from "../session-binding-
|
|
1
|
+
import { d as sessionAllowed } from "../session-binding-zCSuizHs.js";
|
|
2
2
|
import { n as projectEvent, r as structuredBackend, t as compactionEnd } from "../formation-D4LO31WW.js";
|
|
3
3
|
import { t as loadPromptRenderer } from "../render-CJaVcKKC.js";
|
|
4
4
|
import { n as isSubagent } from "../subagent-yJsFxHmH.js";
|
|
5
|
-
import { t as AcnFormation } from "../service-
|
|
6
|
-
import { n as formationReplay, r as connectArchives, t as formationOwnership } from "../formation-replay-
|
|
5
|
+
import { t as AcnFormation } from "../service-C2lXoygJ.js";
|
|
6
|
+
import { n as formationReplay, r as connectArchives, t as formationOwnership } from "../formation-replay-Bf4TSBiz.js";
|
|
7
7
|
//#region src/plugins/formation.ts
|
|
8
8
|
const name = "acn-formation";
|
|
9
9
|
const inject = [
|
package/lib/plugins/inbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as RouteSchema } from "../structured-
|
|
1
|
+
import { o as RouteSchema } from "../structured-C9byFuzm.js";
|
|
2
2
|
import { l as writeYamlAtomic, n as withFileLock } from "../lock-DbmlKOoX.js";
|
|
3
|
-
import { d as sessionAllowed } from "../session-binding-
|
|
3
|
+
import { d as sessionAllowed } from "../session-binding-zCSuizHs.js";
|
|
4
4
|
import { n as projectEvent, r as structuredBackend } from "../formation-D4LO31WW.js";
|
|
5
5
|
import { t as loadPromptRenderer } from "../render-CJaVcKKC.js";
|
|
6
6
|
import { n as isSubagent } from "../subagent-yJsFxHmH.js";
|
|
7
|
-
import { t as AcnInbox } from "../service-
|
|
7
|
+
import { t as AcnInbox } from "../service-BhniAHLo.js";
|
|
8
8
|
//#region src/plugins/inbox.ts
|
|
9
9
|
const name = "acn-inbox";
|
|
10
10
|
const inject = [
|