@plurnk/plurnk-service 1.14.2 → 1.16.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.
- package/.env.defaults +2 -2
- package/SPEC.md +243 -173
- package/digest-sql/curation/curation.sql +1 -1
- package/dist/build-info.json +1 -1
- package/dist/content/byte-view.d.ts +14 -0
- package/dist/content/byte-view.d.ts.map +1 -0
- package/dist/content/byte-view.js +33 -0
- package/dist/content/byte-view.js.map +1 -0
- package/dist/content/edit-receipt.d.ts.map +1 -1
- package/dist/content/edit-receipt.js +12 -1
- package/dist/content/edit-receipt.js.map +1 -1
- package/dist/content/line-marker.d.ts +2 -1
- package/dist/content/line-marker.d.ts.map +1 -1
- package/dist/content/line-marker.js +1 -0
- package/dist/content/line-marker.js.map +1 -1
- package/dist/content/matcher.d.ts +1 -0
- package/dist/content/matcher.d.ts.map +1 -1
- package/dist/content/matcher.js +1 -0
- package/dist/content/matcher.js.map +1 -1
- package/dist/content/read-projector.d.ts +4 -1
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +80 -3
- package/dist/content/read-projector.js.map +1 -1
- package/dist/core/AdmittedTurnExecutor.d.ts +43 -0
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -0
- package/dist/core/AdmittedTurnExecutor.js +245 -0
- package/dist/core/AdmittedTurnExecutor.js.map +1 -0
- package/dist/core/BareBatchRunner.d.ts +26 -0
- package/dist/core/BareBatchRunner.d.ts.map +1 -0
- package/dist/core/BareBatchRunner.js +104 -0
- package/dist/core/BareBatchRunner.js.map +1 -0
- package/dist/core/BudgetReadout.d.ts +1 -1
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +42 -47
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/core/CapabilityResolver.d.ts +2 -1
- package/dist/core/CapabilityResolver.d.ts.map +1 -1
- package/dist/core/CapabilityResolver.js +8 -9
- package/dist/core/CapabilityResolver.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +1 -1
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.d.ts +35 -0
- package/dist/core/DataStatementRunner.d.ts.map +1 -0
- package/dist/core/DataStatementRunner.js +252 -0
- package/dist/core/DataStatementRunner.js.map +1 -0
- package/dist/core/Dispatcher.d.ts +8 -3
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +88 -738
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/EditMutations.d.ts +39 -0
- package/dist/core/EditMutations.d.ts.map +1 -0
- package/dist/core/EditMutations.js +418 -0
- package/dist/core/EditMutations.js.map +1 -0
- package/dist/core/Engine.d.ts +2 -23
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +18 -240
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +24 -23
- package/dist/core/KillHandler.d.ts +32 -0
- package/dist/core/KillHandler.d.ts.map +1 -0
- package/dist/core/KillHandler.js +179 -0
- package/dist/core/KillHandler.js.map +1 -0
- package/dist/core/LogVisibility.d.ts +1 -1
- package/dist/core/LogVisibility.d.ts.map +1 -1
- package/dist/core/LogVisibility.js +3 -4
- package/dist/core/LogVisibility.js.map +1 -1
- package/dist/core/LogWriter.d.ts +42 -0
- package/dist/core/LogWriter.d.ts.map +1 -0
- package/dist/core/LogWriter.js +136 -0
- package/dist/core/LogWriter.js.map +1 -0
- package/dist/core/LoopDriver.d.ts +46 -0
- package/dist/core/LoopDriver.d.ts.map +1 -0
- package/dist/core/LoopDriver.js +263 -0
- package/dist/core/LoopDriver.js.map +1 -0
- package/dist/core/LoopLifecycle.d.ts +2 -1
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/MembershipMaterialization.d.ts +7 -0
- package/dist/core/MembershipMaterialization.d.ts.map +1 -0
- package/dist/core/MembershipMaterialization.js +283 -0
- package/dist/core/MembershipMaterialization.js.map +1 -0
- package/dist/core/MutationEffects.d.ts +29 -0
- package/dist/core/MutationEffects.d.ts.map +1 -0
- package/dist/core/MutationEffects.js +318 -0
- package/dist/core/MutationEffects.js.map +1 -0
- package/dist/core/OverflowTurn.d.ts +4 -4
- package/dist/core/OverflowTurn.d.ts.map +1 -1
- package/dist/core/OverflowTurn.js +6 -7
- package/dist/core/OverflowTurn.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +31 -9
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ResourceMutations.d.ts +12 -36
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +27 -1351
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/ResourceSelector.d.ts +21 -0
- package/dist/core/ResourceSelector.d.ts.map +1 -0
- package/dist/core/ResourceSelector.js +233 -0
- package/dist/core/ResourceSelector.js.map +1 -0
- package/dist/core/ResourceTransfers.d.ts +55 -0
- package/dist/core/ResourceTransfers.d.ts.map +1 -0
- package/dist/core/ResourceTransfers.js +525 -0
- package/dist/core/ResourceTransfers.js.map +1 -0
- package/dist/core/SchemeRegistry.js +2 -2
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/SendBroadcastHandler.d.ts +40 -0
- package/dist/core/SendBroadcastHandler.d.ts.map +1 -0
- package/dist/core/SendBroadcastHandler.js +159 -0
- package/dist/core/SendBroadcastHandler.js.map +1 -0
- package/dist/core/StoredPacket.d.ts +11 -0
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +22 -1
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +19 -9
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/TokenCalibration.d.ts +16 -0
- package/dist/core/TokenCalibration.d.ts.map +1 -0
- package/dist/core/TokenCalibration.js +35 -0
- package/dist/core/TokenCalibration.js.map +1 -0
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +15 -12
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/TurnMaterialization.d.ts +37 -0
- package/dist/core/TurnMaterialization.d.ts.map +1 -0
- package/dist/core/TurnMaterialization.js +296 -0
- package/dist/core/TurnMaterialization.js.map +1 -0
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +6 -8
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +15 -27
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +76 -670
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/WorkerControlHandler.d.ts +15 -0
- package/dist/core/WorkerControlHandler.d.ts.map +1 -0
- package/dist/core/WorkerControlHandler.js +89 -0
- package/dist/core/WorkerControlHandler.js.map +1 -0
- package/dist/core/attachments.d.ts +14 -0
- package/dist/core/attachments.d.ts.map +1 -0
- package/dist/core/attachments.js +18 -0
- package/dist/core/attachments.js.map +1 -0
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +0 -4
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +5 -16
- package/dist/core/git-membership.d.ts +15 -0
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +4 -273
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/git-state.d.ts +2 -1
- package/dist/core/git-state.d.ts.map +1 -1
- package/dist/core/mutation-types.d.ts +102 -0
- package/dist/core/mutation-types.d.ts.map +1 -0
- package/dist/core/mutation-types.js +2 -0
- package/dist/core/mutation-types.js.map +1 -0
- package/dist/core/operation-target-groups.js +1 -1
- package/dist/core/operation-target-groups.js.map +1 -1
- package/dist/core/packet-wire.d.ts +7 -6
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +96 -68
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +0 -1
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +1 -1
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/statement-primary.d.ts +4 -0
- package/dist/core/statement-primary.d.ts.map +1 -0
- package/dist/core/statement-primary.js +3 -0
- package/dist/core/statement-primary.js.map +1 -0
- package/dist/core/teaching-corpus.d.ts +0 -1
- package/dist/core/teaching-corpus.d.ts.map +1 -1
- package/dist/core/teaching-corpus.js +0 -9
- package/dist/core/teaching-corpus.js.map +1 -1
- package/dist/core/turn-scheduler.js +3 -3
- package/dist/core/turn-scheduler.js.map +1 -1
- package/dist/core/turn-signals.d.ts +15 -0
- package/dist/core/turn-signals.d.ts.map +1 -0
- package/dist/core/turn-signals.js +19 -0
- package/dist/core/turn-signals.js.map +1 -0
- package/dist/core/worker-settings.d.ts +0 -1
- package/dist/core/worker-settings.d.ts.map +1 -1
- package/dist/core/worker-settings.js +1 -1
- package/dist/core/worker-settings.js.map +1 -1
- package/dist/digest/Digest.d.ts +3 -16
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +10 -958
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/DigestRender.d.ts +12 -0
- package/dist/digest/DigestRender.d.ts.map +1 -0
- package/dist/digest/DigestRender.js +641 -0
- package/dist/digest/DigestRender.js.map +1 -0
- package/dist/digest/DigestRequiem.d.ts +13 -0
- package/dist/digest/DigestRequiem.d.ts.map +1 -0
- package/dist/digest/DigestRequiem.js +332 -0
- package/dist/digest/DigestRequiem.js.map +1 -0
- package/dist/digest/digest-rows.d.ts +303 -0
- package/dist/digest/digest-rows.d.ts.map +1 -0
- package/dist/digest/digest-rows.js +2 -0
- package/dist/digest/digest-rows.js.map +1 -0
- package/dist/digest/digest.sql +1 -7
- package/dist/observe/api.d.ts +0 -2
- package/dist/observe/api.d.ts.map +1 -1
- package/dist/observe/api.js +2 -2
- package/dist/observe/api.js.map +1 -1
- package/dist/observe/metrics.d.ts +0 -1
- package/dist/observe/metrics.d.ts.map +1 -1
- package/dist/observe/metrics.js +0 -1
- package/dist/observe/metrics.js.map +1 -1
- package/dist/schemes/Exec.d.ts +4 -1
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +89 -48
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +2 -1
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +3 -3
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/File.d.ts +4 -1
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +100 -13
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts +4 -5
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +26 -118
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +1 -66
- package/dist/schemes/Prompt.js +1 -1
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +1 -13
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +3 -1
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +18 -3
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-find.d.ts +4 -2
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +79 -10
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-manifest.d.ts +1 -2
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.d.ts +2 -1
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +20 -2
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-semantic.d.ts +1 -0
- package/dist/schemes/_entry-semantic.d.ts.map +1 -1
- package/dist/schemes/_entry-semantic.js +3 -0
- package/dist/schemes/_entry-semantic.js.map +1 -1
- package/dist/schemes/_entry-semantic.sql +2 -2
- package/dist/schemes/_entry-send.d.ts +0 -1
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +5 -80
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/exec-runtime.d.ts +7 -0
- package/dist/schemes/exec-runtime.d.ts.map +1 -0
- package/dist/schemes/exec-runtime.js +2 -0
- package/dist/schemes/exec-runtime.js.map +1 -0
- package/dist/server/ClientReads.d.ts +34 -0
- package/dist/server/ClientReads.d.ts.map +1 -0
- package/dist/server/ClientReads.js +210 -0
- package/dist/server/ClientReads.js.map +1 -0
- package/dist/server/Daemon.d.ts +12 -22
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +31 -362
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +6 -5
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +3 -2
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +7 -3
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/Functionality.d.ts +0 -12
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts +0 -1
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +3 -3
- package/dist/server/FunctionalityManager.js.map +1 -1
- package/dist/server/MembersFunctionality.d.ts +2 -13
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +4 -4
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/SkillsFunctionality.d.ts +1 -7
- package/dist/server/SkillsFunctionality.d.ts.map +1 -1
- package/dist/server/SkillsFunctionality.js +3 -3
- package/dist/server/SkillsFunctionality.js.map +1 -1
- package/dist/server/WorkerModelResolver.d.ts +17 -0
- package/dist/server/WorkerModelResolver.d.ts.map +1 -0
- package/dist/server/WorkerModelResolver.js +166 -0
- package/dist/server/WorkerModelResolver.js.map +1 -0
- package/dist/server/daemon-results.d.ts +5 -0
- package/dist/server/daemon-results.d.ts.map +1 -0
- package/dist/server/daemon-results.js +7 -0
- package/dist/server/daemon-results.js.map +1 -0
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +4 -6
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/logEntry.d.ts +0 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +1 -13
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +1 -5
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +11 -2
- package/dist/server/loopDocs.js.map +1 -1
- package/migrations/001_schema.sql +30 -347
- package/package.json +30 -30
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type LineMarker, type ParsedPath, type ReadStatement, type ResourceSelection, type SchemeMetadataOrNull, type TextLineMarker } from "@plurnk/plurnk-contracts";
|
|
2
|
+
import { type ScopeNormalization, type SchemeHandler, type SchemeResult } from "@plurnk/plurnk-schemes";
|
|
3
|
+
import type { SchemeManifest, WriterTier, PlurnkSchemeContext } from "./scheme-types.ts";
|
|
4
|
+
import { type EditBatchReceipt, type LineAnchorPrecondition, type ResourceEffect } from "../content/index.ts";
|
|
5
|
+
import type { BoundEntryAddress, EntryAddressResolution } from "./EntryAddressBinding.ts";
|
|
6
|
+
export type DispatchResult = SchemeResult;
|
|
7
|
+
export type EditPreparationContext = {
|
|
8
|
+
readonly workspaceId: number;
|
|
9
|
+
readonly workerId: number;
|
|
10
|
+
readonly loopId: number;
|
|
11
|
+
readonly origin: WriterTier;
|
|
12
|
+
};
|
|
13
|
+
export type PreparedEditBatch = {
|
|
14
|
+
readonly initial: DispatchResult;
|
|
15
|
+
readonly settled: Promise<DispatchResult>;
|
|
16
|
+
aggregate: EditBatchReceipt | undefined;
|
|
17
|
+
settle(result: DispatchResult): void;
|
|
18
|
+
};
|
|
19
|
+
export type EditMergeFact = {
|
|
20
|
+
readonly rule: string;
|
|
21
|
+
} & Record<string, unknown>;
|
|
22
|
+
export type PreparedEdit = {
|
|
23
|
+
readonly first: boolean;
|
|
24
|
+
readonly index: number;
|
|
25
|
+
readonly normalizationIndex: number | null;
|
|
26
|
+
readonly projection: DispatchResult | null;
|
|
27
|
+
readonly batch: PreparedEditBatch;
|
|
28
|
+
readonly receiptIndex: number | null;
|
|
29
|
+
readonly merged: readonly EditMergeFact[];
|
|
30
|
+
};
|
|
31
|
+
export type ResolvedDataEntryAddress = BoundEntryAddress;
|
|
32
|
+
export type PreparedRepresentation = EntryAddressResolution;
|
|
33
|
+
export type MetadataResourceSelection = ResourceSelection & {
|
|
34
|
+
readonly metadata: SchemeMetadataOrNull;
|
|
35
|
+
};
|
|
36
|
+
export type ResourceAddress = {
|
|
37
|
+
readonly target: ParsedPath;
|
|
38
|
+
readonly metadata: SchemeMetadataOrNull;
|
|
39
|
+
readonly scheme: string;
|
|
40
|
+
readonly authority: string;
|
|
41
|
+
readonly pathname: string;
|
|
42
|
+
readonly identityPathname: string;
|
|
43
|
+
readonly channel: string;
|
|
44
|
+
readonly manifest: SchemeManifest;
|
|
45
|
+
};
|
|
46
|
+
export type AddressedResourceSelection = ResourceAddress & {
|
|
47
|
+
readonly lineMarker: TextLineMarker | null;
|
|
48
|
+
};
|
|
49
|
+
export type ResolvedResourceSelection = ResourceAddress & {
|
|
50
|
+
readonly lineMarker: LineMarker | null;
|
|
51
|
+
};
|
|
52
|
+
export type SelectedSource = ResolvedResourceSelection & {
|
|
53
|
+
readonly storageAddress: ResolvedDataEntryAddress;
|
|
54
|
+
readonly content: string;
|
|
55
|
+
readonly completeContent: string;
|
|
56
|
+
readonly bytes?: Uint8Array;
|
|
57
|
+
readonly mimetype: string;
|
|
58
|
+
readonly lineAnchorPrecondition: LineAnchorPrecondition | null;
|
|
59
|
+
readonly scopeNormalizations?: ReadonlyArray<ScopeNormalization>;
|
|
60
|
+
};
|
|
61
|
+
export type DeferredMoveSource = {
|
|
62
|
+
readonly target: ParsedPath;
|
|
63
|
+
readonly metadata: SchemeMetadataOrNull;
|
|
64
|
+
readonly lineMarker: LineMarker | null;
|
|
65
|
+
readonly scheme: string;
|
|
66
|
+
readonly authority: string;
|
|
67
|
+
readonly pathname: string;
|
|
68
|
+
readonly channel: string;
|
|
69
|
+
readonly destination: string;
|
|
70
|
+
readonly lineAnchorPrecondition: LineAnchorPrecondition | null;
|
|
71
|
+
};
|
|
72
|
+
export type PendingResourceEffect = Pick<ResourceEffect, "target" | "action">;
|
|
73
|
+
export type OrchestrationProposalAttrs = {
|
|
74
|
+
readonly proposalScheme?: string;
|
|
75
|
+
readonly proposalTarget?: {
|
|
76
|
+
readonly scheme: string;
|
|
77
|
+
readonly authority: string;
|
|
78
|
+
readonly pathname: string;
|
|
79
|
+
};
|
|
80
|
+
readonly proposalEffects?: readonly PendingResourceEffect[];
|
|
81
|
+
readonly moveSource?: DeferredMoveSource;
|
|
82
|
+
readonly moveDestinationWritten?: string;
|
|
83
|
+
readonly moveDestinationEffects?: readonly ResourceEffect[];
|
|
84
|
+
};
|
|
85
|
+
export type RunOperation = (schemeName: string | null, statement: ReadStatement, ctx: PlurnkSchemeContext) => Promise<DispatchResult>;
|
|
86
|
+
export type PrepareDataRepresentation = (args: {
|
|
87
|
+
target: ParsedPath;
|
|
88
|
+
metadata: SchemeMetadataOrNull;
|
|
89
|
+
routedScheme: string;
|
|
90
|
+
handler: SchemeHandler;
|
|
91
|
+
manifest: SchemeManifest;
|
|
92
|
+
ctx: PlurnkSchemeContext;
|
|
93
|
+
publishedChannel: string | null;
|
|
94
|
+
}) => Promise<PreparedRepresentation>;
|
|
95
|
+
export type ProposalIds = {
|
|
96
|
+
workspaceId: number;
|
|
97
|
+
workerId: number;
|
|
98
|
+
functionalityWorkerId: number;
|
|
99
|
+
loopId: number;
|
|
100
|
+
turnId: number;
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=mutation-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-types.d.ts","sourceRoot":"","sources":["../../src/core/mutation-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxK,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1C,SAAS,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CACxC,CAAC;AAGF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|
// path grammar. The authored statement remains in the forensic turnOps source;
|
|
33
33
|
// only ordinary dispatch receives one clone per independently valid URI.
|
|
34
34
|
export const expandSafeUriTargetGroup = (statement) => {
|
|
35
|
-
if (statement.op !== "READ" && statement.op !== "
|
|
35
|
+
if (statement.op !== "READ" && statement.op !== "KILL")
|
|
36
36
|
return [statement];
|
|
37
37
|
if (statement.target === null)
|
|
38
38
|
return [statement];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-target-groups.js","sourceRoot":"","sources":["../../src/core/operation-target-groups.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,gBAAgB,GAEnB,MAAM,0BAA0B,CAAC;AAElC,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,aAAa,GAAG,CAAC,GAAW,EAAY,EAAE;IAC5C,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAE,CAAC;QACzB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,UAAU,EAAE,CAAC;YACb,SAAS;QACb,CAAC;QACD,IAAI,IAAI,KAAK,GAAG,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACjC,UAAU,EAAE,CAAC;YACb,SAAS;QACb,CAAC;QACD,IAAI,UAAU,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE,SAAS;QAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACpD,IAAI,MAAM,CAAC,MAA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,CAAC;IAC3E,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAEnG,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,MAAO,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,gBAAgB;YAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC;IAChB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
chars: number;
|
|
4
|
-
};
|
|
1
|
+
import type { PacketAttachment, RequestPacket } from "./StoredPacket.ts";
|
|
2
|
+
import type { ChatMessage } from "@plurnk/plurnk-providers";
|
|
5
3
|
interface SectionView {
|
|
6
4
|
name?: unknown;
|
|
7
5
|
slot?: unknown;
|
|
@@ -17,7 +15,7 @@ interface RenderLogOptions {
|
|
|
17
15
|
readonly promptProjectionWeight?: number;
|
|
18
16
|
readonly projectRoot?: string | null;
|
|
19
17
|
}
|
|
20
|
-
|
|
18
|
+
interface ReclaimableLogBody {
|
|
21
19
|
readonly path: string;
|
|
22
20
|
readonly tokensBody: number;
|
|
23
21
|
readonly tokensActive: number;
|
|
@@ -25,7 +23,10 @@ export interface ReclaimableLogBody {
|
|
|
25
23
|
export interface RenderedLog {
|
|
26
24
|
readonly content: string;
|
|
27
25
|
readonly reclaimableBodies: readonly ReclaimableLogBody[];
|
|
26
|
+
readonly attachments: readonly PacketAttachment[];
|
|
28
27
|
}
|
|
28
|
+
import { imageWeight, pdfWeight } from "./attachments.ts";
|
|
29
|
+
export { imageWeight, pdfWeight };
|
|
29
30
|
export default class PacketWire {
|
|
30
31
|
#private;
|
|
31
32
|
static renderSlot(sections: SectionView[], slot: "system" | "user"): string;
|
|
@@ -41,6 +42,6 @@ export default class PacketWire {
|
|
|
41
42
|
role: string;
|
|
42
43
|
content: string;
|
|
43
44
|
}>;
|
|
45
|
+
static wireMessages(packet: RequestPacket, bytesOf: (attachment: PacketAttachment) => Promise<Uint8Array | null>, accepts?: (kind: PacketAttachment["kind"]) => boolean): Promise<ChatMessage[]>;
|
|
44
46
|
}
|
|
45
|
-
export {};
|
|
46
47
|
//# sourceMappingURL=packet-wire.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA0G7E,UAAU,WAAW;IAAG,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC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AAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAQhD;IAGD,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGrC;IAKD,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAErG;IAID,MAAM,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,WAAW,CAUxH;IAKD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1D;IAKD,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAMpF;IAuyBD,OAAa,YAAY,CACrB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,EACrE,OAAO,GAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,OAAoB,GAClE,OAAO,CAAC,WAAW,EAAE,CAAC,CAYxB;CAkEJ"}
|
package/dist/core/packet-wire.js
CHANGED
|
@@ -22,7 +22,7 @@ const editReceiptRevisionChars = () => {
|
|
|
22
22
|
}
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
const previewBounds = () => {
|
|
26
26
|
const rawLines = process.env.PLURNK_SERVICE_PREVIEW_LINES;
|
|
27
27
|
const rawChars = process.env.PLURNK_SERVICE_PREVIEW_CHARS;
|
|
28
28
|
const lines = Number(rawLines);
|
|
@@ -35,6 +35,9 @@ export const previewBounds = () => {
|
|
|
35
35
|
}
|
|
36
36
|
return { lines, chars };
|
|
37
37
|
};
|
|
38
|
+
// {§packet-attachment-parts} — the attachment kinds and their readout weights live in one table.
|
|
39
|
+
import { imageWeight, pdfWeight } from "./attachments.js";
|
|
40
|
+
export { imageWeight, pdfWeight };
|
|
38
41
|
export default class PacketWire {
|
|
39
42
|
// {§packet-markdown} Render the sections in `slot` to one ChatMessage.content
|
|
40
43
|
// string. Sections render in list order; empties are omitted (no empty headers on the wire);
|
|
@@ -47,7 +50,7 @@ export default class PacketWire {
|
|
|
47
50
|
.filter((p) => p.length > 0)
|
|
48
51
|
.join("\n\n");
|
|
49
52
|
}
|
|
50
|
-
// One section → its markdown block (`## {header}\n
|
|
53
|
+
// One section → its markdown block (`## {header}\n{content}`, or bare
|
|
51
54
|
// content when header is null/empty), trailing newlines stripped. Empty
|
|
52
55
|
// content renders to "" so renderSlot drops it. This is the unit the
|
|
53
56
|
// per-section `weight` is measured over.
|
|
@@ -55,16 +58,16 @@ export default class PacketWire {
|
|
|
55
58
|
if (typeof s.content !== "string" || s.content.length === 0)
|
|
56
59
|
return "";
|
|
57
60
|
const header = typeof s.header === "string" && s.header.length > 0 ? s.header : null;
|
|
58
|
-
return (header ? `## ${header}\n
|
|
61
|
+
return (header ? `## ${header}\n${s.content}` : s.content).replace(/\n+$/, "");
|
|
59
62
|
}
|
|
60
|
-
// Durable operation failures render as
|
|
63
|
+
// Durable operation failures render as `{status, path}` JSON pointers to the log rows that
|
|
61
64
|
// own their exact RFC 9457 results.
|
|
62
65
|
static renderFailurePointers(failures) {
|
|
63
66
|
const rows = Array.isArray(failures) ? failures : [];
|
|
64
|
-
|
|
67
|
+
const pointers = rows
|
|
65
68
|
.filter((row) => typeof row.status === "number" && typeof row.coordinate === "string")
|
|
66
|
-
.map((row) =>
|
|
67
|
-
|
|
69
|
+
.map((row) => JSON.stringify({ status: row.status, path: `log:///${row.coordinate}` }));
|
|
70
|
+
return pointers.length === 0 ? "" : `[${pointers.join(",\n")}]`;
|
|
68
71
|
}
|
|
69
72
|
// Non-terminal model-facing observations are deliberately separate from
|
|
70
73
|
// operation failures. Producer messages are normalized and bounded by the
|
|
@@ -86,20 +89,25 @@ export default class PacketWire {
|
|
|
86
89
|
}).join("\n");
|
|
87
90
|
}
|
|
88
91
|
// The Child Streams / Active Child Workers sections ({§child-orientation}) — the OPPOSITE of advice: terse
|
|
89
|
-
//
|
|
92
|
+
// `{status, path}` JSON pointers (same shape as the errors section) to the live things the worker holds,
|
|
90
93
|
// so the model SEES its open streams + unconcluded workers each turn and reasons for itself (READ /
|
|
91
94
|
// OPEN / KILL via the path). Orienting state, never an instruction. "" when none → section omitted.
|
|
92
95
|
static renderChildPointers(rows) {
|
|
93
96
|
const items = Array.isArray(rows) ? rows : [];
|
|
94
|
-
|
|
97
|
+
const pointers = items.map((r) => JSON.stringify({
|
|
98
|
+
status: r.status,
|
|
99
|
+
path: r.path,
|
|
100
|
+
...(typeof r.detail === "string" && r.detail.length > 0 ? { detail: r.detail } : {}),
|
|
101
|
+
}));
|
|
102
|
+
return pointers.length === 0 ? "" : `[${pointers.join(",\n")}]`;
|
|
95
103
|
}
|
|
96
104
|
// The git section content: the working-tree summary. "" when absent.
|
|
97
105
|
static renderGit(git) {
|
|
98
106
|
const status = git === null || git === undefined ? "" : PacketWire.#renderGitState(git);
|
|
99
107
|
return status;
|
|
100
108
|
}
|
|
101
|
-
// The log section's content: the model's curated rows as
|
|
102
|
-
// Data only — no prose leads the
|
|
109
|
+
// The log section's content: the model's curated rows as Markdown-framed records ({§log-wire-format}).
|
|
110
|
+
// Data only — no prose leads the records (the log carries rules for no one). Empty log → ""
|
|
103
111
|
// (the section is omitted).
|
|
104
112
|
static renderLog(entries, weighContent, options = {}) {
|
|
105
113
|
return PacketWire.renderLogWithAccounting(entries, weighContent, options).content;
|
|
@@ -109,13 +117,12 @@ export default class PacketWire {
|
|
|
109
117
|
static renderLogWithAccounting(entries, weighContent, options = {}) {
|
|
110
118
|
const log = Array.isArray(entries) ? entries : [];
|
|
111
119
|
if (log.length === 0)
|
|
112
|
-
return { content: "", reclaimableBodies: [] };
|
|
120
|
+
return { content: "", reclaimableBodies: [], attachments: [] };
|
|
113
121
|
const rows = PacketWire.#renderLogEntries(log, weighContent, options);
|
|
114
|
-
// Every source line is coordinate-prefixed, so source backticks never occupy the
|
|
115
|
-
// CommonMark closing-fence position. The fixed opener keeps the packet prefix cache-stable.
|
|
116
122
|
return {
|
|
117
|
-
content:
|
|
123
|
+
content: rows.map(({ content }) => content).join("\n\n"),
|
|
118
124
|
reclaimableBodies: rows.flatMap(({ reclaimableBody }) => reclaimableBody === null ? [] : [reclaimableBody]),
|
|
125
|
+
attachments: rows.flatMap(({ attachment }) => attachment === null ? [] : [attachment]),
|
|
119
126
|
};
|
|
120
127
|
}
|
|
121
128
|
// Read one section's content by name off a packet (Engine's or re-parsed).
|
|
@@ -137,7 +144,7 @@ export default class PacketWire {
|
|
|
137
144
|
}
|
|
138
145
|
// Number a non-READ body line as `<N>:<line>` — `N:` followed by NO separator whitespace
|
|
139
146
|
// ({§render-rule-line-navigable-prefix}): the leading digit prevents column-zero fence collisions and gives
|
|
140
|
-
// the model line refs for free (
|
|
147
|
+
// the model line refs for free (`### READ0 (...) <42-46>`), while the absence of any separator means a
|
|
141
148
|
// reproduced line has nothing between `N:` and the content to copy — the hard-tab separator used
|
|
142
149
|
// to leak into edit bodies and corrupt indentation. The content's OWN leading whitespace is
|
|
143
150
|
// content, preserved verbatim. `N` is left-padded to the body's line-range width so every body
|
|
@@ -197,7 +204,7 @@ export default class PacketWire {
|
|
|
197
204
|
? PacketWire.#numberLines(content, startLine, numericLineNumberWidth)
|
|
198
205
|
: LineAnchors.render(content, startLine, lineAnchors, lineNumberWidth ?? 0)
|
|
199
206
|
: content;
|
|
200
|
-
return PacketWire.#
|
|
207
|
+
return PacketWire.#frameBody(rendered);
|
|
201
208
|
}
|
|
202
209
|
// Tolerant JSON parser for log entries' persisted rx/tx strings. The engine
|
|
203
210
|
// pre-parses application/json mimetypes; malformed stored text is not JSON.
|
|
@@ -209,18 +216,13 @@ export default class PacketWire {
|
|
|
209
216
|
return null;
|
|
210
217
|
}
|
|
211
218
|
}
|
|
212
|
-
// Stable JSON:
|
|
213
|
-
//
|
|
214
|
-
// same string across turns — prefix-cache friendly.
|
|
219
|
+
// Stable JSON metadata: keys are sorted so the same facts produce the same
|
|
220
|
+
// line across turns — prefix-cache friendly. The preceding H3 owns identity.
|
|
215
221
|
static #canonicalJson(obj) {
|
|
216
222
|
const keys = Object.keys(obj).sort();
|
|
217
223
|
const sorted = {};
|
|
218
|
-
|
|
219
|
-
sorted
|
|
220
|
-
for (const k of keys) {
|
|
221
|
-
if (k !== "path")
|
|
222
|
-
sorted[k] = obj[k];
|
|
223
|
-
}
|
|
224
|
+
for (const k of keys)
|
|
225
|
+
sorted[k] = obj[k];
|
|
224
226
|
return JSON.stringify(sorted);
|
|
225
227
|
}
|
|
226
228
|
static #receiptMeta(value) {
|
|
@@ -237,6 +239,8 @@ export default class PacketWire {
|
|
|
237
239
|
...head,
|
|
238
240
|
change: `-${receipt.effect.removed} +${receipt.effect.inserted}`,
|
|
239
241
|
range: `${receipt.effect.requested} ${receipt.effect.source}->${receipt.effect.result}`,
|
|
242
|
+
// {§edit-receipt-removed-text} — what a deletion took, so it can be put back from the receipt.
|
|
243
|
+
...(receipt.effect.removedText === undefined ? {} : { removed: receipt.effect.removedText }),
|
|
240
244
|
};
|
|
241
245
|
}
|
|
242
246
|
return {
|
|
@@ -251,19 +255,17 @@ export default class PacketWire {
|
|
|
251
255
|
}),
|
|
252
256
|
};
|
|
253
257
|
}
|
|
254
|
-
// {§
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
// checked here too: malformed bodies fail at the one projection boundary.
|
|
259
|
-
static #quoteBody(body) {
|
|
258
|
+
// {§log-wire-format} Every body line carries its ordinary text coordinate,
|
|
259
|
+
// which makes an empty Markdown line and an H3 record boundary unavailable
|
|
260
|
+
// to source content. Already-numbered producer output is checked here too.
|
|
261
|
+
static #frameBody(body) {
|
|
260
262
|
const endsWithLineBreak = /(?:\r\n|\r|\n)$/.test(body);
|
|
261
263
|
const lines = body.split(/\r\n|\r|\n/);
|
|
262
264
|
const contentLines = endsWithLineBreak ? lines.slice(0, -1) : lines;
|
|
263
265
|
if (contentLines.length === 0 || contentLines.some((line) => !/^ *[1-9]\d*:/.test(line) && !LineAnchors.isAnchoredLine(line))) {
|
|
264
|
-
throw new TypeError("A
|
|
266
|
+
throw new TypeError("A packet log body requires a positive coordinate prefix on every physical line.");
|
|
265
267
|
}
|
|
266
|
-
return
|
|
268
|
+
return endsWithLineBreak ? body.replace(/(?:\r\n|\r|\n)$/, "") : body;
|
|
267
269
|
}
|
|
268
270
|
// Render one Log entry → a single bullet line carrying the meta JSON.
|
|
269
271
|
// No body, no fence — every meaningful field is in the JSON. Naming
|
|
@@ -279,10 +281,10 @@ export default class PacketWire {
|
|
|
279
281
|
// LogBody owns tx/rx storage interpretation; packet projection owns only
|
|
280
282
|
// visibility, previewing, mimetype rendering, and metadata.
|
|
281
283
|
// The log:/// handle the model sees for an entry.
|
|
282
|
-
// ({§
|
|
284
|
+
// ({§log-kill-scope}).
|
|
283
285
|
static #entryPath(coordinate, leaf) {
|
|
284
286
|
if (coordinate === null)
|
|
285
|
-
|
|
287
|
+
throw new TypeError("A packet log row requires an addressable coordinate.");
|
|
286
288
|
return `log:///${coordinate}/${leaf}`;
|
|
287
289
|
}
|
|
288
290
|
static #offsetAfterCharacters(text, count) {
|
|
@@ -521,8 +523,6 @@ export default class PacketWire {
|
|
|
521
523
|
const op = typeof e.op === "string" && e.op.length > 0 ? e.op : null;
|
|
522
524
|
const renderedLeaf = LogEntryProjection.leaf(e);
|
|
523
525
|
const path = PacketWire.#entryPath(coordinate, renderedLeaf);
|
|
524
|
-
if (path !== null)
|
|
525
|
-
meta.path = path;
|
|
526
526
|
// Absence = "model" — the worker's own authorship is the default,
|
|
527
527
|
// exactly as `source` absence means the owning worker (#338).
|
|
528
528
|
if (typeof e.origin === "string" && e.origin !== "model")
|
|
@@ -540,23 +540,11 @@ export default class PacketWire {
|
|
|
540
540
|
}
|
|
541
541
|
// Absence = 200 on an ordinary row — the clients' quiet grammar
|
|
542
542
|
// (plurnk#21) applied to the packet. SEND keeps its disposition,
|
|
543
|
-
// KILL keeps decisive destructive completion, a dissolving
|
|
543
|
+
// KILL keeps decisive destructive completion, a dissolving log-KILL
|
|
544
544
|
// receipt exists only to show its status ({§curation-receipt-dissolves}),
|
|
545
545
|
// and every non-200 stays explicit (#338).
|
|
546
|
-
if (typeof e.status === "number" && (op === "SEND" || op === "KILL" ||
|
|
546
|
+
if (typeof e.status === "number" && (op === "SEND" || op === "KILL" || e.status !== 200))
|
|
547
547
|
meta.status = e.status;
|
|
548
|
-
if (e.tags !== undefined) {
|
|
549
|
-
const storedTags = e.tags;
|
|
550
|
-
if (!Array.isArray(storedTags) || !storedTags.every((tag) => typeof tag === "string" && tag.length > 0)) {
|
|
551
|
-
throw new TypeError("A log row carries malformed folksonomic tags.");
|
|
552
|
-
}
|
|
553
|
-
const tags = [...new Set(storedTags)].toSorted();
|
|
554
|
-
if (tags.length !== storedTags.length || tags.some((tag, index) => tag !== storedTags[index])) {
|
|
555
|
-
throw new TypeError("A log row's folksonomic tags must be unique and sorted.");
|
|
556
|
-
}
|
|
557
|
-
if (tags.length > 0)
|
|
558
|
-
meta.tags = tags;
|
|
559
|
-
}
|
|
560
548
|
const tx = (typeof e.tx === "string" ? PacketWire.#safeParse(e.tx) : e.tx);
|
|
561
549
|
if (typeof tx?.annotation === "string")
|
|
562
550
|
meta.annotation = tx.annotation;
|
|
@@ -756,9 +744,6 @@ export default class PacketWire {
|
|
|
756
744
|
: previewExempt
|
|
757
745
|
? { text: projectedBody.content, cut: false, chunk: null }
|
|
758
746
|
: PacketWire.#preview(projectedBody.content);
|
|
759
|
-
if (projection.cut && path === null) {
|
|
760
|
-
throw new Error("a previewed log body requires an addressable log path");
|
|
761
|
-
}
|
|
762
747
|
const projectedLineCount = TextCoordinates.logicalLines(projection.text).length;
|
|
763
748
|
const projectedOrdinals = sourceOrdinals.slice(0, projectedLineCount);
|
|
764
749
|
const body = emptyFind || projection.text.length === 0
|
|
@@ -781,10 +766,9 @@ export default class PacketWire {
|
|
|
781
766
|
if (bodyVisibility.folded.length > 0 && !bodyVisibility.fullyFolded) {
|
|
782
767
|
meta.folded = LogVisibility.format(bodyVisibility.folded);
|
|
783
768
|
}
|
|
784
|
-
// {§
|
|
785
|
-
//
|
|
786
|
-
//
|
|
787
|
-
// friendly no-ops on `none`.
|
|
769
|
+
// {§log-wire-format} — the three body states stay self-describing:
|
|
770
|
+
// coordinate lines ⇒ open, `tokensBody` without lines ⇒ folded,
|
|
771
|
+
// neither ⇒ none. OPEN/FOLD remain friendly no-ops on `none`.
|
|
788
772
|
const display = fullBody.content.length === 0
|
|
789
773
|
? "none"
|
|
790
774
|
: bodyVisibility.fullyFolded
|
|
@@ -797,37 +781,81 @@ export default class PacketWire {
|
|
|
797
781
|
&& !bodyVisibility.fullyFolded
|
|
798
782
|
? PacketWire.#sparseChunk(fullBody.content, projectedBody.content, sourceOrdinals, projection.text)
|
|
799
783
|
: projection.chunk;
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
: "";
|
|
784
|
+
if (display === "open" && projectedChunk !== null)
|
|
785
|
+
meta.chunk = projectedChunk;
|
|
803
786
|
const renderRow = () => {
|
|
804
|
-
const
|
|
787
|
+
const metadata = PacketWire.#canonicalJson(meta);
|
|
805
788
|
return display === "open"
|
|
806
|
-
?
|
|
807
|
-
:
|
|
789
|
+
? `### ${path}\n${metadata}\n${body}`
|
|
790
|
+
: `### ${path}\n${metadata}`;
|
|
808
791
|
};
|
|
809
792
|
// The accounting field participates in the row it measures. Iterate
|
|
810
793
|
// until its decimal width and therefore the rendered row's curation
|
|
811
794
|
// weight are stable. The metadata share is derivable (tokensActive −
|
|
812
795
|
// tokensBody when open; tokensActive otherwise) and feeds no
|
|
813
796
|
// curation decision, so it is not serialized (#338).
|
|
797
|
+
// {§packet-attachment-parts} — an open READ of an attachable member carries it as a native
|
|
798
|
+
// part on a route that can take it; the row weighs the attachment whether or not the route can.
|
|
799
|
+
const attachment = display === "open" && op === "READ" ? PacketWire.#attachmentOf(e.rx, e.target) : null;
|
|
800
|
+
if (attachment !== null)
|
|
801
|
+
meta.tokensAttachment = attachment.weight;
|
|
814
802
|
meta.tokensActive = 0;
|
|
815
803
|
for (let pass = 0; pass < 8; pass += 1) {
|
|
816
|
-
const tokensActive = weighContent(renderRow());
|
|
804
|
+
const tokensActive = weighContent(renderRow()) + (attachment?.weight ?? 0);
|
|
817
805
|
if (meta.tokensActive === tokensActive) {
|
|
818
806
|
const tokensBody = typeof meta.tokensBody === "number" ? meta.tokensBody : 0;
|
|
819
807
|
return {
|
|
820
808
|
content: renderRow(),
|
|
821
|
-
reclaimableBody: display === "open" &&
|
|
809
|
+
reclaimableBody: display === "open" && tokensBody > 0
|
|
822
810
|
? { path, tokensBody, tokensActive }
|
|
823
811
|
: null,
|
|
812
|
+
attachment,
|
|
824
813
|
};
|
|
825
814
|
}
|
|
826
815
|
meta.tokensActive = tokensActive;
|
|
827
816
|
}
|
|
828
|
-
throw new Error("
|
|
817
|
+
throw new Error("packet log row accounting did not converge");
|
|
829
818
|
});
|
|
830
819
|
}
|
|
820
|
+
static #attachmentOf(rx, target) {
|
|
821
|
+
const view = rx;
|
|
822
|
+
const pathname = typeof target?.pathname === "string" && target.pathname.length > 0
|
|
823
|
+
? target.pathname
|
|
824
|
+
: typeof target?.raw === "string" ? target.raw : null;
|
|
825
|
+
if (pathname === null)
|
|
826
|
+
return null;
|
|
827
|
+
const scheme = target?.scheme ?? "file";
|
|
828
|
+
const image = view?.image;
|
|
829
|
+
if (image !== undefined && typeof image.mimetype === "string" && Number.isSafeInteger(image.width) && Number.isSafeInteger(image.height)) {
|
|
830
|
+
const width = image.width;
|
|
831
|
+
const height = image.height;
|
|
832
|
+
return { scheme, pathname, mimetype: image.mimetype, kind: "image", width, height, weight: imageWeight(width, height) };
|
|
833
|
+
}
|
|
834
|
+
const document = view?.document;
|
|
835
|
+
if (document !== undefined && typeof document.mimetype === "string" && Number.isSafeInteger(document.pages)) {
|
|
836
|
+
const pages = document.pages;
|
|
837
|
+
return { scheme, pathname, mimetype: document.mimetype, kind: "pdf", pages, weight: pdfWeight(pages) };
|
|
838
|
+
}
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
// {§packet-attachment-parts} — the wire form with native parts: the user slot's text first, then
|
|
842
|
+
// one part per attachment of a kind the route accepts whose bytes the scheme still supplies; a
|
|
843
|
+
// picture rides as an image part, a document as a file part.
|
|
844
|
+
static async wireMessages(packet, bytesOf, accepts = () => true) {
|
|
845
|
+
const [system, user] = PacketWire.packetToWireMessages(packet);
|
|
846
|
+
const parts = [{ type: "text", text: user.content }];
|
|
847
|
+
for (const attachment of packet.attachments ?? []) {
|
|
848
|
+
if (!accepts(attachment.kind))
|
|
849
|
+
continue;
|
|
850
|
+
const bytes = await bytesOf(attachment);
|
|
851
|
+
if (bytes === null)
|
|
852
|
+
continue;
|
|
853
|
+
parts.push(attachment.kind === "image"
|
|
854
|
+
? { type: "image", image: bytes, mediaType: attachment.mimetype }
|
|
855
|
+
: { type: "file", data: bytes, mediaType: attachment.mimetype });
|
|
856
|
+
}
|
|
857
|
+
return parts.length === 1 ? [system, user] : [system, { role: "user", content: parts }];
|
|
858
|
+
}
|
|
831
859
|
static #projectRelativeCwd(cwd, projectRoot) {
|
|
832
860
|
if (projectRoot === null || cwd === projectRoot)
|
|
833
861
|
return null;
|