omnius 1.0.923 → 1.0.925
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/dist/{providerRegistry.d.ts → _types/backend-vllm/providerRegistry.d.ts} +0 -1
- package/dist/_types/backend-vllm/types.d.ts +209 -0
- package/dist/_types/execution/av/media-capability.d.ts +94 -0
- package/dist/_types/execution/delegation-contract.d.ts +102 -0
- package/dist/_types/execution/evidence.d.ts +68 -0
- package/dist/_types/execution/html-source-evidence.d.ts +65 -0
- package/dist/_types/execution/mcp/types.d.ts +169 -0
- package/dist/_types/execution/mutation-contract.d.ts +102 -0
- package/dist/_types/execution/nol/artifacts.d.ts +39 -0
- package/dist/_types/execution/nol/checkpoint-edits.d.ts +98 -0
- package/dist/_types/execution/nol/distributions.d.ts +128 -0
- package/dist/_types/execution/nol/gguf-checkpoint-edits.d.ts +194 -0
- package/dist/_types/execution/nol/gguf-control-reader.d.ts +224 -0
- package/dist/_types/execution/nol/lora-exports.d.ts +129 -0
- package/dist/_types/execution/nol/neuronary.d.ts +212 -0
- package/dist/_types/execution/nol/pytorch-control-reader.d.ts +143 -0
- package/dist/_types/execution/nol/qwen35-head-sites.d.ts +61 -0
- package/dist/_types/execution/nol/worker-assets.d.ts +82 -0
- package/dist/_types/execution/nol/worker-protocol.d.ts +94 -0
- package/dist/_types/execution/page-content-source.d.ts +40 -0
- package/dist/_types/execution/rapid-computer-use/artifact-store.d.ts +21 -0
- package/dist/_types/execution/rapid-computer-use/contracts.d.ts +320 -0
- package/dist/_types/execution/rapid-computer-use/decision.d.ts +70 -0
- package/dist/_types/execution/rapid-computer-use/desktop-verification.d.ts +23 -0
- package/dist/_types/execution/rapid-computer-use/geometry.d.ts +57 -0
- package/dist/_types/execution/rapid-computer-use/planner.d.ts +78 -0
- package/dist/_types/execution/rapid-computer-use/trace.d.ts +80 -0
- package/dist/_types/execution/rapid-computer-use/visual.d.ts +48 -0
- package/dist/_types/execution/shell-runs.d.ts +78 -0
- package/dist/_types/execution/streamed-web-source.d.ts +64 -0
- package/dist/_types/execution/tools/browser-page-fallback.d.ts +25 -0
- package/dist/_types/execution/tools/network-egress-policy.d.ts +30 -0
- package/dist/_types/execution/tools/pdf-native-tables.d.ts +46 -0
- package/dist/_types/execution/tools/todo-store.d.ts +133 -0
- package/dist/_types/execution/tools/web-fetch.d.ts +57 -0
- package/dist/_types/execution/tools/workboard.d.ts +1223 -0
- package/dist/_types/execution/types.d.ts +549 -0
- package/dist/_types/execution/web-source.d.ts +14 -0
- package/dist/_types/memory/artifactReviewSourceIndex.d.ts +133 -0
- package/dist/_types/memory/contextMemoryLedger.d.ts +213 -0
- package/dist/_types/memory/db.d.ts +12 -0
- package/dist/_types/memory/embeddings.d.ts +36 -0
- package/dist/_types/memory/immutableEvidenceStore.d.ts +165 -0
- package/dist/_types/memory/memoryIngestion.d.ts +65 -0
- package/dist/_types/memory/memoryTypes.d.ts +312 -0
- package/dist/_types/memory/sourceCorpusStore.d.ts +331 -0
- package/dist/_types/memory/structuredMemoryStore.d.ts +105 -0
- package/dist/_types/memory/unifiedMemoryStore.d.ts +127 -0
- package/dist/_types/memory/virtualMemory.d.ts +187 -0
- package/dist/_types/orchestrator/agentic-page-content-receipt.d.ts +20 -0
- package/dist/_types/orchestrator/agentic-web-fetch-receipt.d.ts +20 -0
- package/dist/_types/orchestrator/agenticRunner.d.ts +5219 -0
- package/dist/_types/orchestrator/app-state.d.ts +171 -0
- package/dist/_types/orchestrator/artifactClaimCritic.d.ts +63 -0
- package/dist/_types/orchestrator/artifactQuality.d.ts +15 -0
- package/dist/_types/orchestrator/artifactSemanticIntegrity.d.ts +203 -0
- package/dist/_types/orchestrator/canonical-context-projection.d.ts +254 -0
- package/dist/_types/orchestrator/canonical-source-body-projection.d.ts +51 -0
- package/dist/_types/orchestrator/completion-review-pending.d.ts +24 -0
- package/dist/_types/orchestrator/completionContract.d.ts +103 -0
- package/dist/_types/orchestrator/completionFinalization.d.ts +224 -0
- package/dist/_types/orchestrator/completionLedger.d.ts +429 -0
- package/dist/_types/orchestrator/completionReadiness.d.ts +234 -0
- package/dist/_types/orchestrator/context-admission.d.ts +93 -0
- package/dist/_types/orchestrator/context-dump-retention.d.ts +25 -0
- package/dist/_types/orchestrator/context-fabric.d.ts +133 -0
- package/dist/_types/orchestrator/contextEngine.d.ts +68 -0
- package/dist/_types/orchestrator/contextWindowDump.d.ts +327 -0
- package/dist/_types/orchestrator/convergence-breaker.d.ts +225 -0
- package/dist/_types/orchestrator/convergence-progress.d.ts +66 -0
- package/dist/_types/orchestrator/deliveryCoverage.d.ts +181 -0
- package/dist/_types/orchestrator/document-persistence-goal-binding.d.ts +106 -0
- package/dist/_types/orchestrator/durable-document-worker.d.ts +85 -0
- package/dist/_types/orchestrator/evidenceBranch.d.ts +291 -0
- package/dist/_types/orchestrator/expected-inference-response.d.ts +55 -0
- package/dist/_types/orchestrator/expectedOutcomeContract.d.ts +58 -0
- package/dist/_types/orchestrator/failure-taxonomy.d.ts +36 -0
- package/dist/_types/orchestrator/focusSupervisor.d.ts +436 -0
- package/dist/_types/orchestrator/forced-update-requirement-recovery.d.ts +105 -0
- package/dist/_types/orchestrator/hooks.d.ts +100 -0
- package/dist/_types/orchestrator/inference-pressure.d.ts +61 -0
- package/dist/_types/orchestrator/integrationClosure.d.ts +89 -0
- package/dist/_types/orchestrator/interruption-lifecycle.d.ts +154 -0
- package/dist/_types/orchestrator/live-memory-passages.d.ts +51 -0
- package/dist/_types/orchestrator/liveVirtualContext.d.ts +84 -0
- package/dist/_types/orchestrator/memory-compiler.d.ts +254 -0
- package/dist/_types/orchestrator/memory-consolidation.d.ts +134 -0
- package/dist/_types/orchestrator/model-router.d.ts +17 -0
- package/dist/_types/orchestrator/modelResponseDiagnostics.d.ts +71 -0
- package/dist/_types/orchestrator/nativeRequirementAmendment.d.ts +63 -0
- package/dist/_types/orchestrator/nol/coordinator.d.ts +204 -0
- package/dist/_types/orchestrator/nol/datasets.d.ts +58 -0
- package/dist/_types/orchestrator/nol/discovery.d.ts +286 -0
- package/dist/_types/orchestrator/nol/evaluation.d.ts +59 -0
- package/dist/_types/orchestrator/nol/model-validation.d.ts +198 -0
- package/dist/_types/orchestrator/nol/statistics.d.ts +142 -0
- package/dist/_types/orchestrator/nol/store.d.ts +133 -0
- package/dist/_types/orchestrator/nol/variant-registry.d.ts +292 -0
- package/dist/_types/orchestrator/ollama-context-policy.d.ts +34 -0
- package/dist/_types/orchestrator/personality.d.ts +66 -0
- package/dist/_types/orchestrator/prompt-cache.d.ts +24 -0
- package/dist/_types/orchestrator/remote-inference-fallback.d.ts +224 -0
- package/dist/_types/orchestrator/remote-inference-policy.d.ts +58 -0
- package/dist/_types/orchestrator/request-budget.d.ts +75 -0
- package/dist/_types/orchestrator/requirementCoverage.d.ts +69 -0
- package/dist/_types/orchestrator/reviewedInterpretation.d.ts +111 -0
- package/dist/_types/orchestrator/runEvents.d.ts +115 -0
- package/dist/_types/orchestrator/runtime-rollout.d.ts +63 -0
- package/dist/_types/orchestrator/semanticVerification.d.ts +135 -0
- package/dist/_types/orchestrator/source-wide-extraction.d.ts +202 -0
- package/dist/_types/orchestrator/steeringIntake.d.ts +123 -0
- package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +89 -0
- package/dist/_types/orchestrator/structuredMemoryInference.d.ts +62 -0
- package/dist/_types/orchestrator/successful-procedure-memory.d.ts +127 -0
- package/dist/_types/orchestrator/supportedAnswer.d.ts +68 -0
- package/dist/_types/orchestrator/taskEffectEvidence.d.ts +38 -0
- package/dist/_types/orchestrator/taskExecutionSnapshot.d.ts +67 -0
- package/dist/_types/orchestrator/taskObjective.d.ts +310 -0
- package/dist/_types/orchestrator/taskObjectiveContinuation.d.ts +134 -0
- package/dist/_types/orchestrator/taskRequirementReview.d.ts +246 -0
- package/dist/_types/orchestrator/taskRequirements.d.ts +80 -0
- package/dist/_types/orchestrator/taskSemanticAdmission.d.ts +159 -0
- package/dist/_types/orchestrator/taskWorkDelegation.d.ts +147 -0
- package/dist/_types/orchestrator/taskWorkPlan.d.ts +177 -0
- package/dist/_types/orchestrator/telegram-passive-history.d.ts +42 -0
- package/dist/_types/orchestrator/terminalTaskReport.d.ts +91 -0
- package/dist/_types/orchestrator/todoObservability.d.ts +147 -0
- package/dist/_types/orchestrator/tool-exposure-policy.d.ts +100 -0
- package/dist/_types/orchestrator/trajectory-checkpoint.d.ts +159 -0
- package/dist/_types/orchestrator/types.d.ts +185 -0
- package/dist/_types/schemas/dispatch.d.ts +53 -0
- package/dist/_types/schemas/feature-workflow.d.ts +362 -0
- package/dist/_types/schemas/messages.d.ts +15 -0
- package/dist/_types/schemas/nol-assets.d.ts +955 -0
- package/dist/_types/schemas/nol-json.d.ts +2 -0
- package/dist/_types/schemas/nol.d.ts +3995 -0
- package/dist/_types/schemas/patch.d.ts +47 -0
- package/dist/_types/schemas/plan.d.ts +47 -0
- package/dist/_types/schemas/repoProfile.d.ts +116 -0
- package/dist/_types/schemas/retrieval.d.ts +44 -0
- package/dist/_types/schemas/task.d.ts +57 -0
- package/dist/_types/schemas/tools.d.ts +16 -0
- package/dist/_types/schemas/verification.d.ts +31 -0
- package/dist/api/py-embed.js +3353 -1829
- package/dist/assets/nol-checkpoint-editor.py +701 -0
- package/dist/assets/nol-gguf-checkpoint-editor.py +785 -0
- package/dist/assets/nol-gguf-control-reader.py +428 -0
- package/dist/assets/nol-gne-tools-worker.py +425 -0
- package/dist/assets/nol-gne-worker.py +1081 -0
- package/dist/assets/nol-lora-exporter.py +349 -0
- package/dist/assets/nol-pytorch-control-reader.py +470 -0
- package/dist/assets/nol-transformers-nnsight-worker.py +512 -0
- package/dist/assets/nol-transformers-peft-validation-worker.py +385 -0
- package/dist/assets/nol-transformers-peft-worker.py +488 -0
- package/dist/assets/nol-transformers-research-worker.py +472 -0
- package/dist/assets/nol-transformers-worker.py +920 -0
- package/dist/assets/nol-vllm-owned-worker.py +803 -0
- package/dist/assets/nol-vllm-runtime.py +695 -0
- package/dist/assets/nol-vllm-tokenizer.py +93 -0
- package/dist/assets/nol-vllm-worker.py +201 -0
- package/dist/computer-use/configured-planner.d.ts +37 -0
- package/dist/computer-use/configured-point.d.ts +35 -0
- package/dist/computer-use/host-session.d.ts +60 -0
- package/dist/computer-use/runner-ui-port.d.ts +37 -0
- package/dist/computer-use/session-review.d.ts +14 -0
- package/dist/computer-use/task-spec.d.ts +84 -0
- package/dist/discovery.d.ts +16 -2
- package/dist/index.js +2 -2
- package/dist/library.d.ts +94 -10
- package/dist/library.js +144003 -87414
- package/dist/memory-maintenance-worker.js +1676 -511
- package/dist/nol/cpu-control-reader-profile.d.ts +93 -0
- package/dist/nol/cpu-control-reader-service.d.ts +87 -0
- package/dist/nol/cuda-lease.d.ts +111 -0
- package/dist/nol/cuda-mutations.d.ts +34 -0
- package/dist/nol/export-runtime-config.d.ts +114 -0
- package/dist/nol/export-service.d.ts +143 -0
- package/dist/nol/facade.d.ts +147 -0
- package/dist/nol/gguf-cpu-control-reader-profile.d.ts +106 -0
- package/dist/nol/gguf-cpu-control-reader-service.d.ts +91 -0
- package/dist/nol/gguf-model-control-verifier.d.ts +120 -0
- package/dist/nol/gguf-parameter-inventory.d.ts +28 -0
- package/dist/nol/gne-adapter.d.ts +134 -0
- package/dist/nol/gne-agent-evaluation.d.ts +84 -0
- package/dist/nol/gne-profile.d.ts +124 -0
- package/dist/nol/gne-tools-profile.d.ts +148 -0
- package/dist/nol/gne-tools-transport.d.ts +194 -0
- package/dist/nol/model-actions.d.ts +662 -0
- package/dist/nol/model-control-verifier.d.ts +135 -0
- package/dist/nol/model-json-scorer.d.ts +13 -0
- package/dist/nol/model-runtime-config.d.ts +830 -0
- package/dist/nol/model-serving.d.ts +130 -0
- package/dist/nol/model-subject-adapter.d.ts +72 -0
- package/dist/nol/model-validation-factory.d.ts +113 -0
- package/dist/nol/neuronary-catalog.d.ts +130 -0
- package/dist/nol/orphan-custody.d.ts +72 -0
- package/dist/nol/peft-conformance.d.ts +48 -0
- package/dist/nol/peft-control-types.d.ts +137 -0
- package/dist/nol/peft-control-verifier.d.ts +8 -0
- package/dist/nol/peft-model-actions.d.ts +41 -0
- package/dist/nol/peft-model-authority.d.ts +146 -0
- package/dist/nol/peft-model-controls.d.ts +20 -0
- package/dist/nol/peft-model-host.d.ts +47 -0
- package/dist/nol/peft-model-profile.d.ts +161 -0
- package/dist/nol/peft-model-runtime-config.d.ts +174 -0
- package/dist/nol/peft-model-subject-adapter.d.ts +36 -0
- package/dist/nol/peft-validation.d.ts +105 -0
- package/dist/nol/persistent-parameter-inventory.d.ts +32 -0
- package/dist/nol/runtime.d.ts +100 -0
- package/dist/nol/sqlite-store.d.ts +80 -0
- package/dist/nol/transformers-adapter.d.ts +119 -0
- package/dist/nol/transformers-nnsight.d.ts +87 -0
- package/dist/nol/transformers-peft.d.ts +107 -0
- package/dist/nol/transformers-research.d.ts +114 -0
- package/dist/nol/variant-service.d.ts +143 -0
- package/dist/nol/variant-store.d.ts +51 -0
- package/dist/nol/vllm-actions.d.ts +774 -0
- package/dist/nol/vllm-adapter.d.ts +1473 -0
- package/dist/nol/vllm-authority.d.ts +55 -0
- package/dist/nol/vllm-conformance.d.ts +662 -0
- package/dist/nol/vllm-profile.d.ts +850 -0
- package/dist/nol/vllm-protocol.d.ts +1505 -0
- package/dist/nol/vllm-runtime-config.d.ts +120 -0
- package/dist/nol/vllm-runtime.d.ts +34 -0
- package/dist/nol/vllm-startup.d.ts +235 -0
- package/dist/omni-setup-worker.js +3433 -1909
- package/dist/service-version.d.ts +0 -1
- package/dist/tui/async-process.d.ts +27 -0
- package/dist/tui/native/worker.js +3 -1
- package/dist/tui/telegram-action-session-registry.d.ts +136 -0
- package/dist/tui/telegram-cognition-queue.d.ts +154 -0
- package/dist/tui/telegram-context-packet-v2.d.ts +99 -0
- package/dist/tui/telegram-input-ownership.d.ts +78 -0
- package/dist/tui/telegram-turn-contract-v2.d.ts +62 -0
- package/dist/update-worker-runtime.js +4216 -2603
- package/docs/DISCOVERY.json +389 -0
- package/docs/DISCOVERY.md +4 -0
- package/npm-shrinkwrap.json +28 -12
- package/package.json +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface AsyncProcessOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
env?: NodeJS.ProcessEnv;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
maxBuffer?: number;
|
|
6
|
+
input?: string | Buffer;
|
|
7
|
+
}
|
|
8
|
+
export interface AsyncProcessResult {
|
|
9
|
+
stdout: Buffer;
|
|
10
|
+
stderr: Buffer;
|
|
11
|
+
exitCode: number | null;
|
|
12
|
+
signal: NodeJS.Signals | null;
|
|
13
|
+
}
|
|
14
|
+
export declare class AsyncProcessError extends Error {
|
|
15
|
+
stdout: Buffer;
|
|
16
|
+
stderr: Buffer;
|
|
17
|
+
exitCode: number | null;
|
|
18
|
+
signal: NodeJS.Signals | null;
|
|
19
|
+
constructor(message: string, result: AsyncProcessResult);
|
|
20
|
+
}
|
|
21
|
+
export declare function runProcessBuffer(file: string, args?: string[], options?: AsyncProcessOptions): Promise<AsyncProcessResult>;
|
|
22
|
+
export declare function execFileBuffer(file: string, args?: string[], options?: AsyncProcessOptions): Promise<Buffer>;
|
|
23
|
+
export declare function execFileText(file: string, args?: string[], options?: AsyncProcessOptions): Promise<string>;
|
|
24
|
+
export declare function execShellText(command: string, options?: AsyncProcessOptions): Promise<string>;
|
|
25
|
+
export declare function commandExists(command: string, timeout?: number): Promise<boolean>;
|
|
26
|
+
export declare function shellQuote(value: string): string;
|
|
27
|
+
export declare function delay(ms: number): Promise<void>;
|
|
@@ -6143,6 +6143,7 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
6143
6143
|
|
|
6144
6144
|
// packages/cli/src/tui/command-registry.ts
|
|
6145
6145
|
var COMMAND_SIGNATURES = [
|
|
6146
|
+
["/nol <action> [args]", "Control explicit project research experiments (local operator only)"],
|
|
6146
6147
|
["/enhance <prompt>", "Enhance a prompt into the input editor"],
|
|
6147
6148
|
["/model", "Select from available models"],
|
|
6148
6149
|
["/model <name>", "Switch to a specific model"],
|
|
@@ -6977,6 +6978,7 @@ var ALIASES = {
|
|
|
6977
6978
|
platforms: ["gateway"]
|
|
6978
6979
|
};
|
|
6979
6980
|
var USER_ONLY = /* @__PURE__ */ new Set([
|
|
6981
|
+
"nol",
|
|
6980
6982
|
"enhance",
|
|
6981
6983
|
"provider",
|
|
6982
6984
|
"fallback",
|
|
@@ -7154,7 +7156,7 @@ var REST_BLOCKED = /* @__PURE__ */ new Set([
|
|
|
7154
7156
|
"paste",
|
|
7155
7157
|
"indicator"
|
|
7156
7158
|
]);
|
|
7157
|
-
var LOCAL_TUI_ONLY = /* @__PURE__ */ new Set(["indicator", "compacted", "gpu", "memory", "provider", "enhance"]);
|
|
7159
|
+
var LOCAL_TUI_ONLY = /* @__PURE__ */ new Set(["indicator", "compacted", "gpu", "memory", "provider", "enhance", "nol"]);
|
|
7158
7160
|
var CANONICAL_BY_ALIAS = /* @__PURE__ */ new Map();
|
|
7159
7161
|
for (const [canonical, aliases2] of Object.entries(ALIASES)) {
|
|
7160
7162
|
for (const alias of aliases2) CANONICAL_BY_ALIAS.set(alias, canonical);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent, bridge-independent ownership for Telegram action runners.
|
|
3
|
+
*
|
|
4
|
+
* AgenticRunner supports repeated run() calls, but its event subscription API
|
|
5
|
+
* has no unsubscribe operation. This registry binds one permanent dispatcher
|
|
6
|
+
* when a runner is created, then routes events only to the active lease. A
|
|
7
|
+
* bridge can therefore reuse a runner without adding one listener per turn.
|
|
8
|
+
*/
|
|
9
|
+
export interface TelegramActionSessionTarget {
|
|
10
|
+
/** Existing Telegram chat/thread session key. */
|
|
11
|
+
readonly chatSessionKey: string;
|
|
12
|
+
/** Stable user or other principal key within that chat. */
|
|
13
|
+
readonly principalKey: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TelegramActionSessionRunner<TResult, TEvent = unknown> {
|
|
16
|
+
run(task: string, context?: string, actualUserGoal?: string): Promise<TResult>;
|
|
17
|
+
abort(): void;
|
|
18
|
+
onEvent(handler: (event: TEvent) => void): void;
|
|
19
|
+
}
|
|
20
|
+
export interface TelegramActionSessionCreateContext<TTypedEvent = unknown> {
|
|
21
|
+
readonly key: string;
|
|
22
|
+
readonly target: TelegramActionSessionTarget;
|
|
23
|
+
readonly generation: number;
|
|
24
|
+
/** Stable dispatcher suitable for AgenticRunnerOptions.onTypedEvent. */
|
|
25
|
+
readonly onTypedEvent: (event: TTypedEvent) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface TelegramActionSessionResource<TRunner> {
|
|
28
|
+
readonly runner: TRunner;
|
|
29
|
+
/** Optional cleanup for resources not covered by runner.abort(). */
|
|
30
|
+
readonly dispose?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export type TelegramActionSessionEvictionReason = "ttl" | "lru" | "incompatible" | "shutdown";
|
|
33
|
+
export interface TelegramActionSessionRegistryOptions<TResult, TEvent, TTypedEvent, TRunner extends TelegramActionSessionRunner<TResult, TEvent>> {
|
|
34
|
+
readonly create: (context: TelegramActionSessionCreateContext<TTypedEvent>) => TelegramActionSessionResource<TRunner>;
|
|
35
|
+
readonly ttlMs?: number;
|
|
36
|
+
readonly maxEntries?: number;
|
|
37
|
+
readonly now?: () => number;
|
|
38
|
+
readonly onEvict?: (snapshot: TelegramActionSessionSnapshot, reason: TelegramActionSessionEvictionReason) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface TelegramActionSessionAcquireOptions<TEvent, TTypedEvent> {
|
|
41
|
+
readonly target: TelegramActionSessionTarget;
|
|
42
|
+
readonly ownerId: string;
|
|
43
|
+
/**
|
|
44
|
+
* Fingerprint of runner-static configuration: model, endpoint, surface,
|
|
45
|
+
* tool policy, state root, session id, and stable prompt contract version.
|
|
46
|
+
*/
|
|
47
|
+
readonly compatibilityKey: string;
|
|
48
|
+
readonly onEvent?: (event: TEvent, token: TelegramActionSessionLeaseToken) => void;
|
|
49
|
+
readonly onTypedEvent?: (event: TTypedEvent, token: TelegramActionSessionLeaseToken) => void;
|
|
50
|
+
}
|
|
51
|
+
export interface TelegramActionSessionRunInput<TRunner> {
|
|
52
|
+
readonly task: string;
|
|
53
|
+
/** Current-turn context. Do not put changing conversation state in the compatibility key. */
|
|
54
|
+
readonly context?: string;
|
|
55
|
+
readonly actualUserGoal?: string;
|
|
56
|
+
/** Configure current-turn tools or working directory immediately before run(). */
|
|
57
|
+
readonly prepare?: (runner: TRunner) => void | Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export interface TelegramActionSessionLeaseToken {
|
|
60
|
+
readonly key: string;
|
|
61
|
+
readonly generation: number;
|
|
62
|
+
readonly leaseId: number;
|
|
63
|
+
readonly ownerId: string;
|
|
64
|
+
}
|
|
65
|
+
export type TelegramActionSessionReleaseStatus = "released" | "running" | "stale";
|
|
66
|
+
export interface TelegramActionSessionLease<TResult, TRunner> {
|
|
67
|
+
readonly token: TelegramActionSessionLeaseToken;
|
|
68
|
+
readonly target: TelegramActionSessionTarget;
|
|
69
|
+
run(input: TelegramActionSessionRunInput<TRunner>): Promise<TResult>;
|
|
70
|
+
abort(): boolean;
|
|
71
|
+
release(): TelegramActionSessionReleaseStatus;
|
|
72
|
+
}
|
|
73
|
+
export type TelegramActionSessionAcquireFailureStatus = "busy" | "capacity" | "closed";
|
|
74
|
+
export type TelegramActionSessionAcquireResult<TResult, TRunner> = {
|
|
75
|
+
readonly status: "acquired";
|
|
76
|
+
readonly lease: TelegramActionSessionLease<TResult, TRunner>;
|
|
77
|
+
} | {
|
|
78
|
+
readonly status: TelegramActionSessionAcquireFailureStatus;
|
|
79
|
+
readonly reason: string;
|
|
80
|
+
readonly current?: TelegramActionSessionSnapshot;
|
|
81
|
+
};
|
|
82
|
+
export interface TelegramActionSessionSnapshot {
|
|
83
|
+
readonly key: string;
|
|
84
|
+
readonly target: TelegramActionSessionTarget;
|
|
85
|
+
readonly generation: number;
|
|
86
|
+
readonly compatibilityKey: string;
|
|
87
|
+
readonly createdAtMs: number;
|
|
88
|
+
readonly lastUsedAtMs: number;
|
|
89
|
+
readonly busy: boolean;
|
|
90
|
+
readonly ownerId?: string;
|
|
91
|
+
readonly leaseId?: number;
|
|
92
|
+
readonly runStarted: boolean;
|
|
93
|
+
}
|
|
94
|
+
export type TelegramActionSessionLeaseErrorCode = "stale_lease" | "already_started";
|
|
95
|
+
export declare class TelegramActionSessionLeaseError extends Error {
|
|
96
|
+
readonly code: TelegramActionSessionLeaseErrorCode;
|
|
97
|
+
constructor(code: TelegramActionSessionLeaseErrorCode, message: string);
|
|
98
|
+
}
|
|
99
|
+
export declare function createTelegramActionSessionTarget(target: TelegramActionSessionTarget): TelegramActionSessionTarget;
|
|
100
|
+
export declare function telegramActionSessionKey(targetInput: TelegramActionSessionTarget): string;
|
|
101
|
+
/**
|
|
102
|
+
* A bounded registry for reusable AgenticRunner-compatible action sessions.
|
|
103
|
+
* It owns only in-memory runner resources. AgenticRunner stateDir/sessionId
|
|
104
|
+
* remain the durable continuity authority.
|
|
105
|
+
*/
|
|
106
|
+
export declare class TelegramActionSessionRegistry<TResult, TEvent = unknown, TTypedEvent = unknown, TRunner extends TelegramActionSessionRunner<TResult, TEvent> = TelegramActionSessionRunner<TResult, TEvent>> {
|
|
107
|
+
private readonly entries;
|
|
108
|
+
private readonly create;
|
|
109
|
+
private readonly ttlMs;
|
|
110
|
+
private readonly maxEntries;
|
|
111
|
+
private readonly now;
|
|
112
|
+
private readonly onEvict?;
|
|
113
|
+
private generationSequence;
|
|
114
|
+
private leaseSequence;
|
|
115
|
+
private closed;
|
|
116
|
+
constructor(options: TelegramActionSessionRegistryOptions<TResult, TEvent, TTypedEvent, TRunner>);
|
|
117
|
+
get size(): number;
|
|
118
|
+
acquire(options: TelegramActionSessionAcquireOptions<TEvent, TTypedEvent>): TelegramActionSessionAcquireResult<TResult, TRunner>;
|
|
119
|
+
pruneExpired(): number;
|
|
120
|
+
snapshot(): readonly TelegramActionSessionSnapshot[];
|
|
121
|
+
/** Abort active work, dispose every cached resource, and reject new leases. */
|
|
122
|
+
shutdown(): void;
|
|
123
|
+
private createEntry;
|
|
124
|
+
private runLease;
|
|
125
|
+
private abortLease;
|
|
126
|
+
private releaseLease;
|
|
127
|
+
private finishLease;
|
|
128
|
+
private ownedEntry;
|
|
129
|
+
private dispatchEvent;
|
|
130
|
+
private dispatchTypedEvent;
|
|
131
|
+
private pruneExpiredAt;
|
|
132
|
+
private evictLeastRecentlyUsedIdle;
|
|
133
|
+
private evictEntry;
|
|
134
|
+
private snapshotEntry;
|
|
135
|
+
private readNow;
|
|
136
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type InferencePressureCoordinator } from "../_types/orchestrator/inference-pressure.js";
|
|
2
|
+
export declare const TELEGRAM_COGNITION_AUTHORITY: "internal_cognition_only";
|
|
3
|
+
export type TelegramCognitionJobKind = "social_state" | "memory" | "reflection" | "cognition_batch";
|
|
4
|
+
export type TelegramCognitionQueueState = "open" | "closing" | "closed";
|
|
5
|
+
export type TelegramCognitionAdmissionStatus = "accepted" | "deduplicated" | "rejected_capacity" | "rejected_pressure" | "rejected_closed";
|
|
6
|
+
export type TelegramCognitionJobStatus = "succeeded" | "failed" | "timed_out" | "cancelled" | "preempted" | "rejected_capacity" | "rejected_pressure" | "rejected_closed";
|
|
7
|
+
export type TelegramCognitionFailureKind = "timeout" | "capacity_refusal" | "provider_refusal";
|
|
8
|
+
/**
|
|
9
|
+
* Content-free failure evidence passed between inference transport, the
|
|
10
|
+
* bounded cognition queue, and the room sweep. Decisions use fixed transport
|
|
11
|
+
* contracts and exception types. They never inspect user or model text.
|
|
12
|
+
*/
|
|
13
|
+
export interface TelegramCognitionFailureReceipt {
|
|
14
|
+
readonly schema: "omnius.telegram-cognition-failure.v1";
|
|
15
|
+
readonly kind: TelegramCognitionFailureKind;
|
|
16
|
+
readonly retryable: boolean;
|
|
17
|
+
readonly status?: number;
|
|
18
|
+
readonly reasonCode: string;
|
|
19
|
+
readonly retryAfterMs?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class TelegramCognitionTerminalFailure extends Error {
|
|
22
|
+
readonly receipt: TelegramCognitionFailureReceipt;
|
|
23
|
+
constructor(receipt: TelegramCognitionFailureReceipt);
|
|
24
|
+
}
|
|
25
|
+
export declare function telegramCognitionFailureFromInferenceError(error: unknown): TelegramCognitionFailureReceipt | null;
|
|
26
|
+
export interface TelegramCognitionJobContext {
|
|
27
|
+
/** This queue has no Telegram send/reply authority. */
|
|
28
|
+
readonly authority: typeof TELEGRAM_COGNITION_AUTHORITY;
|
|
29
|
+
readonly jobId: string;
|
|
30
|
+
readonly scopeKey: string;
|
|
31
|
+
readonly kind: TelegramCognitionJobKind;
|
|
32
|
+
readonly signal: AbortSignal;
|
|
33
|
+
readonly deadlineAtMs: number;
|
|
34
|
+
}
|
|
35
|
+
export interface TelegramCognitionJob {
|
|
36
|
+
jobId?: string;
|
|
37
|
+
/** Jobs with the same scope never start concurrently. */
|
|
38
|
+
scopeKey: string;
|
|
39
|
+
/** Deduplication is scoped: one active key per scope. */
|
|
40
|
+
dedupeKey: string;
|
|
41
|
+
kind: TelegramCognitionJobKind;
|
|
42
|
+
/** Overrides the queue default for this job. */
|
|
43
|
+
timeBudgetMs?: number;
|
|
44
|
+
execute: (context: TelegramCognitionJobContext) => void | Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export interface TelegramCognitionJobOutcome {
|
|
47
|
+
jobId: string;
|
|
48
|
+
scopeKey: string;
|
|
49
|
+
dedupeKey: string;
|
|
50
|
+
kind: TelegramCognitionJobKind;
|
|
51
|
+
status: TelegramCognitionJobStatus;
|
|
52
|
+
enqueuedAtMs: number;
|
|
53
|
+
startedAtMs?: number;
|
|
54
|
+
finishedAtMs: number;
|
|
55
|
+
queueWaitMs?: number;
|
|
56
|
+
runDurationMs?: number;
|
|
57
|
+
errorMessage?: string;
|
|
58
|
+
failure?: TelegramCognitionFailureReceipt;
|
|
59
|
+
}
|
|
60
|
+
export interface TelegramCognitionEnqueueReceipt {
|
|
61
|
+
admission: TelegramCognitionAdmissionStatus;
|
|
62
|
+
jobId: string;
|
|
63
|
+
scopeKey: string;
|
|
64
|
+
dedupeKey: string;
|
|
65
|
+
completion: Promise<TelegramCognitionJobOutcome>;
|
|
66
|
+
}
|
|
67
|
+
export interface TelegramCognitionQueueOptions {
|
|
68
|
+
/** Maximum jobs that may execute concurrently across distinct scopes. */
|
|
69
|
+
maxConcurrentScopes: number;
|
|
70
|
+
/** Maximum jobs waiting to start. Running jobs do not consume this bound. */
|
|
71
|
+
maxQueuedJobs: number;
|
|
72
|
+
defaultTimeBudgetMs: number;
|
|
73
|
+
/** Process-wide model pressure authority. Defaults to the shared authority. */
|
|
74
|
+
inferencePressureCoordinator?: InferencePressureCoordinator;
|
|
75
|
+
}
|
|
76
|
+
export interface TelegramCognitionQueueTotals {
|
|
77
|
+
accepted: number;
|
|
78
|
+
deduplicated: number;
|
|
79
|
+
rejectedCapacity: number;
|
|
80
|
+
rejectedPressure: number;
|
|
81
|
+
rejectedClosed: number;
|
|
82
|
+
started: number;
|
|
83
|
+
succeeded: number;
|
|
84
|
+
failed: number;
|
|
85
|
+
timedOut: number;
|
|
86
|
+
cancelled: number;
|
|
87
|
+
preempted: number;
|
|
88
|
+
}
|
|
89
|
+
export interface TelegramCognitionQueueSnapshot {
|
|
90
|
+
state: TelegramCognitionQueueState;
|
|
91
|
+
maxConcurrentScopes: number;
|
|
92
|
+
maxQueuedJobs: number;
|
|
93
|
+
defaultTimeBudgetMs: number;
|
|
94
|
+
queuedJobs: number;
|
|
95
|
+
runningJobs: number;
|
|
96
|
+
activeScopes: string[];
|
|
97
|
+
queuedByScope: Record<string, number>;
|
|
98
|
+
oldestQueuedAgeMs: number;
|
|
99
|
+
totals: TelegramCognitionQueueTotals;
|
|
100
|
+
}
|
|
101
|
+
export interface TelegramCognitionCloseOptions {
|
|
102
|
+
/** Cancel work that has not started. Default false: drain accepted work. */
|
|
103
|
+
cancelQueued?: boolean;
|
|
104
|
+
/** Abort running work. Default false: let accepted work drain. */
|
|
105
|
+
cancelRunning?: boolean;
|
|
106
|
+
reason?: string;
|
|
107
|
+
}
|
|
108
|
+
export declare class TelegramCognitionQueueValidationError extends Error {
|
|
109
|
+
constructor(message: string);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Bounded scheduler for post-delivery Telegram cognition. It serializes each
|
|
113
|
+
* scope, admits multiple scopes up to a global cap, and contains every job
|
|
114
|
+
* failure in a resolved outcome. The execution context intentionally carries
|
|
115
|
+
* no visible-message delivery capability.
|
|
116
|
+
*
|
|
117
|
+
* Cancellation and time budgets use AbortSignal. An execute function must stop
|
|
118
|
+
* external work when its signal aborts; JavaScript cannot forcibly terminate
|
|
119
|
+
* an arbitrary closure that ignores cancellation.
|
|
120
|
+
*/
|
|
121
|
+
export declare class TelegramCognitionQueue {
|
|
122
|
+
private readonly maxConcurrentScopes;
|
|
123
|
+
private readonly maxQueuedJobs;
|
|
124
|
+
private readonly defaultTimeBudgetMs;
|
|
125
|
+
private readonly pressure;
|
|
126
|
+
private readonly unsubscribePressure;
|
|
127
|
+
private readonly pending;
|
|
128
|
+
private readonly running;
|
|
129
|
+
private readonly activeScopes;
|
|
130
|
+
private readonly dedupe;
|
|
131
|
+
private readonly jobsById;
|
|
132
|
+
private readonly idleWaiters;
|
|
133
|
+
private readonly totals;
|
|
134
|
+
private state;
|
|
135
|
+
private pumpScheduled;
|
|
136
|
+
private nextJobSequence;
|
|
137
|
+
private readonly scopeOrdinals;
|
|
138
|
+
private nextScopeOrdinal;
|
|
139
|
+
private lastStartedScopeOrdinal;
|
|
140
|
+
constructor(options: TelegramCognitionQueueOptions);
|
|
141
|
+
enqueue(job: TelegramCognitionJob): TelegramCognitionEnqueueReceipt;
|
|
142
|
+
cancel(jobId: string, reason?: string): boolean;
|
|
143
|
+
cancelScope(scopeKey: string, reason?: string): number;
|
|
144
|
+
snapshot(): TelegramCognitionQueueSnapshot;
|
|
145
|
+
waitForIdle(): Promise<void>;
|
|
146
|
+
close(options?: TelegramCognitionCloseOptions): Promise<void>;
|
|
147
|
+
private rejectedReceipt;
|
|
148
|
+
private schedulePump;
|
|
149
|
+
private pump;
|
|
150
|
+
private nextPendingIndex;
|
|
151
|
+
private start;
|
|
152
|
+
private finish;
|
|
153
|
+
private maybeResolveIdle;
|
|
154
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION: 2;
|
|
2
|
+
export type TelegramContextPacketStabilityV2 = "stable" | "dynamic";
|
|
3
|
+
export interface TelegramContextRecordV2 {
|
|
4
|
+
/** Stable identity within the parent semantic block. */
|
|
5
|
+
recordId: string;
|
|
6
|
+
/** Complete model-visible record. The compiler never slices this value. */
|
|
7
|
+
content: string;
|
|
8
|
+
/** Lower values render first. Defaults to zero. */
|
|
9
|
+
order?: number;
|
|
10
|
+
/** Higher values are admitted first when the segment has a finite budget. */
|
|
11
|
+
priority?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface TelegramContextSemanticBlockV2 {
|
|
14
|
+
/** Stable meaning-level identity, independent of the block's current text. */
|
|
15
|
+
semanticId: string;
|
|
16
|
+
/** Monotonic revision. The highest revision for one semantic ID wins. */
|
|
17
|
+
revision: number;
|
|
18
|
+
/** Stable blocks form the reusable prefix; dynamic blocks follow it. */
|
|
19
|
+
stability: TelegramContextPacketStabilityV2;
|
|
20
|
+
/** Lower values render first. Defaults to zero. */
|
|
21
|
+
order?: number;
|
|
22
|
+
/** Higher values are admitted first when the segment has a finite budget. */
|
|
23
|
+
priority?: number;
|
|
24
|
+
records: readonly TelegramContextRecordV2[];
|
|
25
|
+
}
|
|
26
|
+
export interface TelegramContextPacketBudgetsV2 {
|
|
27
|
+
stableChars: number;
|
|
28
|
+
dynamicChars: number;
|
|
29
|
+
}
|
|
30
|
+
export interface TelegramContextPacketCompileInputV2 {
|
|
31
|
+
blocks: readonly TelegramContextSemanticBlockV2[];
|
|
32
|
+
budgets: TelegramContextPacketBudgetsV2;
|
|
33
|
+
}
|
|
34
|
+
export interface TelegramContextOmittedRecordV2 {
|
|
35
|
+
semanticId: string;
|
|
36
|
+
revision: number;
|
|
37
|
+
recordId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface TelegramContextOmissionReceiptV2 {
|
|
40
|
+
type: "telegram_context_omission_receipt_v2";
|
|
41
|
+
schemaVersion: typeof TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION;
|
|
42
|
+
segment: TelegramContextPacketStabilityV2;
|
|
43
|
+
reason: "char_budget";
|
|
44
|
+
omittedBlockCount: number;
|
|
45
|
+
omittedRecordCount: number;
|
|
46
|
+
omittedDigest: string;
|
|
47
|
+
omittedSemanticIds: string[];
|
|
48
|
+
omittedRecords: TelegramContextOmittedRecordV2[];
|
|
49
|
+
}
|
|
50
|
+
export interface TelegramContextCompiledRecordV2 extends TelegramContextOmittedRecordV2 {
|
|
51
|
+
content: string;
|
|
52
|
+
order: number;
|
|
53
|
+
priority: number;
|
|
54
|
+
serializedChars: number;
|
|
55
|
+
}
|
|
56
|
+
export interface TelegramContextCompiledBlockV2 {
|
|
57
|
+
semanticId: string;
|
|
58
|
+
revision: number;
|
|
59
|
+
stability: TelegramContextPacketStabilityV2;
|
|
60
|
+
order: number;
|
|
61
|
+
priority: number;
|
|
62
|
+
records: TelegramContextCompiledRecordV2[];
|
|
63
|
+
}
|
|
64
|
+
export interface TelegramContextCompiledSegmentV2 {
|
|
65
|
+
segment: TelegramContextPacketStabilityV2;
|
|
66
|
+
text: string;
|
|
67
|
+
charLength: number;
|
|
68
|
+
budgetChars: number;
|
|
69
|
+
blocks: TelegramContextCompiledBlockV2[];
|
|
70
|
+
omissionReceipt?: TelegramContextOmissionReceiptV2;
|
|
71
|
+
}
|
|
72
|
+
export interface TelegramContextPacketCompilationV2 {
|
|
73
|
+
schemaVersion: typeof TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION;
|
|
74
|
+
stablePrefix: string;
|
|
75
|
+
stablePrefixHash: string;
|
|
76
|
+
dynamicContext: string;
|
|
77
|
+
combinedContext: string;
|
|
78
|
+
selectedRevisions: Record<string, number>;
|
|
79
|
+
stable: TelegramContextCompiledSegmentV2;
|
|
80
|
+
dynamic: TelegramContextCompiledSegmentV2;
|
|
81
|
+
}
|
|
82
|
+
export declare class TelegramContextPacketValidationError extends Error {
|
|
83
|
+
constructor(message: string);
|
|
84
|
+
}
|
|
85
|
+
export declare class TelegramContextPacketRevisionConflictError extends Error {
|
|
86
|
+
constructor(semanticId: string, revision: number);
|
|
87
|
+
}
|
|
88
|
+
export declare class TelegramContextPacketBudgetError extends Error {
|
|
89
|
+
readonly segment: TelegramContextPacketStabilityV2;
|
|
90
|
+
readonly budgetChars: number;
|
|
91
|
+
readonly requiredChars: number;
|
|
92
|
+
constructor(segment: TelegramContextPacketStabilityV2, budgetChars: number, requiredChars: number);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Compile canonical Telegram context into independently budgeted stable and
|
|
96
|
+
* dynamic JSONL segments. Selection uses typed metadata only. Record content
|
|
97
|
+
* is either serialized in full or represented by an omission receipt.
|
|
98
|
+
*/
|
|
99
|
+
export declare function compileTelegramContextPacketV2(input: TelegramContextPacketCompileInputV2): TelegramContextPacketCompilationV2;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative, transport-independent ownership for one Telegram input.
|
|
3
|
+
*
|
|
4
|
+
* This module deliberately does not infer intent. It accepts only exact
|
|
5
|
+
* identities and monotonic owner generations, then preserves the first
|
|
6
|
+
* committed decision and delivery receipt. Callers can therefore retry an
|
|
7
|
+
* operation without replacing an already-authoritative result.
|
|
8
|
+
*/
|
|
9
|
+
export type TelegramTurnDispositionKind = "no_reply" | "chat_reply" | "action";
|
|
10
|
+
export type TelegramInputLifecycleState = "received" | "classified" | "queued" | "dispatched" | "deferred" | "decision_committed" | "delivery_committed" | "consumed" | "superseded" | "failed";
|
|
11
|
+
export type TelegramInputTerminalLifecycleState = "consumed" | "superseded" | "failed";
|
|
12
|
+
export interface TelegramInputTargetBinding {
|
|
13
|
+
readonly inputId: string;
|
|
14
|
+
readonly sessionKey: string;
|
|
15
|
+
readonly chatId: string;
|
|
16
|
+
readonly messageId: number;
|
|
17
|
+
readonly messageThreadId: number;
|
|
18
|
+
readonly senderActorKey: string;
|
|
19
|
+
}
|
|
20
|
+
export interface TelegramInputOwnerClaim {
|
|
21
|
+
readonly ownerId: string;
|
|
22
|
+
readonly generation: number;
|
|
23
|
+
}
|
|
24
|
+
export interface TelegramInputDecisionCommit {
|
|
25
|
+
readonly decisionId: string;
|
|
26
|
+
readonly contractFingerprint: string;
|
|
27
|
+
readonly contractVersion: 2;
|
|
28
|
+
readonly disposition: TelegramTurnDispositionKind;
|
|
29
|
+
readonly committedBy: TelegramInputOwnerClaim;
|
|
30
|
+
readonly committedAtMs: number;
|
|
31
|
+
}
|
|
32
|
+
export type TelegramInputDeliveryKind = "visible_reply" | "action_effect";
|
|
33
|
+
export interface TelegramInputDeliveryCommit {
|
|
34
|
+
readonly deliveryId: string;
|
|
35
|
+
readonly decisionId: string;
|
|
36
|
+
readonly kind: TelegramInputDeliveryKind;
|
|
37
|
+
readonly transportReceiptId: string;
|
|
38
|
+
readonly committedBy: TelegramInputOwnerClaim;
|
|
39
|
+
readonly committedAtMs: number;
|
|
40
|
+
}
|
|
41
|
+
export interface TelegramInputLifecycleEvent {
|
|
42
|
+
readonly state: TelegramInputLifecycleState;
|
|
43
|
+
readonly atMs: number;
|
|
44
|
+
readonly owner: TelegramInputOwnerClaim;
|
|
45
|
+
}
|
|
46
|
+
export interface TelegramInputOwnershipRecord {
|
|
47
|
+
readonly target: TelegramInputTargetBinding;
|
|
48
|
+
readonly owner: TelegramInputOwnerClaim;
|
|
49
|
+
readonly lifecycle: TelegramInputLifecycleState;
|
|
50
|
+
readonly revision: number;
|
|
51
|
+
readonly decision?: TelegramInputDecisionCommit;
|
|
52
|
+
readonly delivery?: TelegramInputDeliveryCommit;
|
|
53
|
+
readonly terminal?: TelegramInputTerminalLifecycleState;
|
|
54
|
+
readonly history: readonly TelegramInputLifecycleEvent[];
|
|
55
|
+
}
|
|
56
|
+
export type TelegramInputMutationStatus = "applied" | "duplicate" | "stale" | "contradiction" | "terminal" | "invalid_transition" | "unknown_input";
|
|
57
|
+
export interface TelegramInputMutationResult {
|
|
58
|
+
readonly status: TelegramInputMutationStatus;
|
|
59
|
+
readonly record?: TelegramInputOwnershipRecord;
|
|
60
|
+
readonly reason?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function createTelegramInputTargetBinding(target: TelegramInputTargetBinding): TelegramInputTargetBinding;
|
|
63
|
+
export declare function telegramInputTargetsEqual(left: TelegramInputTargetBinding, right: TelegramInputTargetBinding): boolean;
|
|
64
|
+
export declare function isTelegramInputTerminalLifecycle(state: TelegramInputLifecycleState): state is TelegramInputTerminalLifecycleState;
|
|
65
|
+
/** In-memory authority primitive. Persistence remains the caller's concern. */
|
|
66
|
+
export declare class TelegramInputOwnershipLedger {
|
|
67
|
+
private readonly records;
|
|
68
|
+
get(inputId: string): TelegramInputOwnershipRecord | undefined;
|
|
69
|
+
register(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim, atMs?: number): TelegramInputMutationResult;
|
|
70
|
+
claim(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim): TelegramInputMutationResult;
|
|
71
|
+
transition(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim, nextState: TelegramInputLifecycleState, atMs?: number): TelegramInputMutationResult;
|
|
72
|
+
commitDecision(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim, decisionInput: Omit<TelegramInputDecisionCommit, "committedBy" | "committedAtMs">, atMs?: number): TelegramInputMutationResult;
|
|
73
|
+
commitDelivery(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim, deliveryInput: Omit<TelegramInputDeliveryCommit, "committedBy" | "committedAtMs">, atMs?: number): TelegramInputMutationResult;
|
|
74
|
+
complete(targetInput: TelegramInputTargetBinding, ownerInput: TelegramInputOwnerClaim, terminal: TelegramInputTerminalLifecycleState, atMs?: number): TelegramInputMutationResult;
|
|
75
|
+
private boundRecord;
|
|
76
|
+
private authorizedRecord;
|
|
77
|
+
private storeLifecycle;
|
|
78
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type TelegramInputTargetBinding, type TelegramTurnDispositionKind } from "./telegram-input-ownership.js";
|
|
2
|
+
export declare const TELEGRAM_TURN_CONTRACT_V2_VERSION: 2;
|
|
3
|
+
export type TelegramTurnSelfRoleV2 = "addressee" | "participant" | "observer" | "uncertain";
|
|
4
|
+
export type TelegramTurnReplyBasisV2 = "direct_turn" | "ongoing_self_task" | "social_intervention" | "none" | "uncertain";
|
|
5
|
+
interface TelegramTurnContractV2Base {
|
|
6
|
+
readonly version: 2;
|
|
7
|
+
readonly kind: TelegramTurnDispositionKind;
|
|
8
|
+
readonly inputId: string;
|
|
9
|
+
readonly target: TelegramInputTargetBinding;
|
|
10
|
+
readonly confidence: number;
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
readonly addressedActorKeys: readonly string[];
|
|
13
|
+
readonly selfRole: TelegramTurnSelfRoleV2;
|
|
14
|
+
readonly replyBasis: TelegramTurnReplyBasisV2;
|
|
15
|
+
readonly evidenceIds: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface TelegramNoReplyTurnContractV2 extends TelegramTurnContractV2Base {
|
|
18
|
+
readonly kind: "no_reply";
|
|
19
|
+
}
|
|
20
|
+
export interface TelegramChatReplyTurnContractV2 extends TelegramTurnContractV2Base {
|
|
21
|
+
readonly kind: "chat_reply";
|
|
22
|
+
readonly reply: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TelegramActionTurnContractV2 extends TelegramTurnContractV2Base {
|
|
25
|
+
readonly kind: "action";
|
|
26
|
+
readonly objective: string;
|
|
27
|
+
}
|
|
28
|
+
export type TelegramTurnContractV2 = TelegramNoReplyTurnContractV2 | TelegramChatReplyTurnContractV2 | TelegramActionTurnContractV2;
|
|
29
|
+
export interface TelegramTurnContractV2ValidationContext {
|
|
30
|
+
readonly target: TelegramInputTargetBinding;
|
|
31
|
+
readonly selfActorKey?: string;
|
|
32
|
+
readonly actorKeys: readonly string[];
|
|
33
|
+
readonly evidenceIds: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export type TelegramTurnContractV2ValidationIssueCode = "not_object" | "unknown_field" | "invalid_version" | "invalid_kind" | "invalid_field" | "target_mismatch" | "unknown_actor_key" | "unknown_evidence_id" | "reply_not_authorized" | "missing_input" | "unexpected_input" | "duplicate_input" | "contradictory_input";
|
|
36
|
+
export interface TelegramTurnContractV2ValidationIssue {
|
|
37
|
+
readonly code: TelegramTurnContractV2ValidationIssueCode;
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TelegramTurnContractV2ValidationResult {
|
|
42
|
+
readonly ok: boolean;
|
|
43
|
+
readonly value: TelegramTurnContractV2 | null;
|
|
44
|
+
readonly issues: readonly TelegramTurnContractV2ValidationIssue[];
|
|
45
|
+
}
|
|
46
|
+
export type TelegramTurnBatchInputStatus = "accepted" | "duplicate" | "missing" | "invalid" | "contradiction";
|
|
47
|
+
export interface TelegramTurnBatchInputDispositionV2 {
|
|
48
|
+
readonly inputId: string;
|
|
49
|
+
readonly status: TelegramTurnBatchInputStatus;
|
|
50
|
+
readonly contract: TelegramTurnContractV2 | null;
|
|
51
|
+
readonly issues: readonly TelegramTurnContractV2ValidationIssue[];
|
|
52
|
+
}
|
|
53
|
+
export interface TelegramTurnBatchValidationResultV2 {
|
|
54
|
+
readonly ok: boolean;
|
|
55
|
+
readonly dispositions: readonly TelegramTurnBatchInputDispositionV2[];
|
|
56
|
+
readonly issues: readonly TelegramTurnContractV2ValidationIssue[];
|
|
57
|
+
}
|
|
58
|
+
export declare function validateTelegramTurnContractV2(raw: unknown, context: TelegramTurnContractV2ValidationContext): TelegramTurnContractV2ValidationResult;
|
|
59
|
+
export declare function telegramTurnContractV2Fingerprint(contract: TelegramTurnContractV2): string;
|
|
60
|
+
/** Validate one exact disposition for every expected input in a coalesced batch. */
|
|
61
|
+
export declare function validateTelegramTurnBatchV2(raw: unknown, contexts: readonly TelegramTurnContractV2ValidationContext[]): TelegramTurnBatchValidationResultV2;
|
|
62
|
+
export {};
|