dsh-run2skill 0.3.1 → 0.5.0-alpha.2

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.
@@ -0,0 +1,87 @@
1
+ import { z } from "zod";
2
+ //#region src/adapters/dsh-remote/contract.ts
3
+ const RUN2SKILL_QUERY_ENDPOINTS = [
4
+ "observe-summary",
5
+ "attention",
6
+ "proposals/list",
7
+ "summary",
8
+ "proposals/get",
9
+ "recent-activity/list",
10
+ "learning/status",
11
+ "learning/issues/list",
12
+ "purge/preview",
13
+ "purge/status"
14
+ ];
15
+ const RUN2SKILL_COMMAND_ENDPOINTS = [
16
+ "proposals/approve",
17
+ "proposals/reject",
18
+ "proposals/retry",
19
+ "proposals/refresh",
20
+ "proposals/revise",
21
+ "coverage/confirm-discard",
22
+ "learning/request",
23
+ "learning/issues/retry",
24
+ "learning/issues/dismiss",
25
+ "purge/confirm",
26
+ "purge/retry"
27
+ ];
28
+ const queryEndpoints = new Set(RUN2SKILL_QUERY_ENDPOINTS);
29
+ const commandEndpoints = new Set(RUN2SKILL_COMMAND_ENDPOINTS);
30
+ function routeRun2skillEndpoint(endpoint) {
31
+ if (queryEndpoints.has(endpoint)) return "query";
32
+ if (commandEndpoints.has(endpoint)) return "command";
33
+ throw new TypeError(`unknown run2skill endpoint: ${endpoint}`);
34
+ }
35
+ const jsonValue = z.json();
36
+ const queryRequest = z.object({
37
+ endpoint: z.enum(RUN2SKILL_QUERY_ENDPOINTS),
38
+ payload: jsonValue
39
+ }).strict();
40
+ const commandRequest = z.object({
41
+ endpoint: z.enum(RUN2SKILL_COMMAND_ENDPOINTS),
42
+ payload: jsonValue
43
+ }).strict();
44
+ const rpcResult = z.discriminatedUnion("ok", [z.object({
45
+ ok: z.literal(true),
46
+ value: jsonValue
47
+ }).strict(), z.object({
48
+ ok: z.literal(false),
49
+ error: z.object({
50
+ code: z.string().min(1),
51
+ message: z.string(),
52
+ details: z.record(z.string(), jsonValue)
53
+ }).strict()
54
+ }).strict()]);
55
+ function descriptor(method, requestSchema) {
56
+ const value = {
57
+ id: `dsh-run2skill#run2skill/${method}`,
58
+ service: "run2skillRemote",
59
+ namespace: "run2skill",
60
+ method,
61
+ invocation: { kind: "direct" },
62
+ parameters: [{
63
+ name: "request",
64
+ wire: "request",
65
+ source: "json",
66
+ codec: {
67
+ mode: "strict",
68
+ typeSymbol: method === "query" ? "Run2skillQueryRequest" : "Run2skillCommandRequest",
69
+ create: () => requestSchema
70
+ }
71
+ }],
72
+ cancellation: { parameter: "signal" },
73
+ result: {
74
+ mode: "strict",
75
+ typeSymbol: "Run2skillRpcResult",
76
+ create: () => rpcResult
77
+ }
78
+ };
79
+ return Object.freeze(value);
80
+ }
81
+ const RUN2SKILL_REMOTE_DESCRIPTORS = Object.freeze([descriptor("query", queryRequest), descriptor("command", commandRequest)]);
82
+ const RUN2SKILL_REMOTE = Object.freeze({
83
+ package: "dsh-run2skill",
84
+ descriptors: RUN2SKILL_REMOTE_DESCRIPTORS
85
+ });
86
+ //#endregion
87
+ export { RUN2SKILL_REMOTE_DESCRIPTORS as n, routeRun2skillEndpoint as r, RUN2SKILL_REMOTE as t };
package/lib/index.d.ts CHANGED
@@ -4841,12 +4841,24 @@ interface SessionPersistenceSnapshot {
4841
4841
  readonly header: DshSessionHeader;
4842
4842
  readonly revision: string;
4843
4843
  }
4844
- interface SessionPersistencePort {
4845
- listSnapshots(signal?: AbortSignal): Promise<readonly SessionPersistenceSnapshot[]>;
4846
- readFrom(sessionId: string, fromSeq: number, signal?: AbortSignal): Promise<{
4847
- readonly meta: DshSessionHeader;
4844
+ interface DshSessionReadHandlePort {
4845
+ readonly header: DshSessionHeader;
4846
+ read(offset?: number, length?: number, options?: {
4847
+ readonly signal?: AbortSignal;
4848
+ }): Promise<{
4849
+ readonly eventState: 'detached' | 'shared-frozen';
4848
4850
  readonly events: readonly DshSessionEvent[];
4849
4851
  }>;
4852
+ close(): Promise<void>;
4853
+ }
4854
+ /** DSH 0.1.3-alpha.2 persistence service exposed as ctx.sessionPersistence. */
4855
+ interface DshSessionPersistencePort {
4856
+ list(options?: {
4857
+ readonly signal?: AbortSignal;
4858
+ }): Promise<readonly SessionPersistenceSnapshot[]>;
4859
+ open(sessionId: string, access: 'read', options?: {
4860
+ readonly signal?: AbortSignal;
4861
+ }): Promise<DshSessionReadHandlePort>;
4850
4862
  }
4851
4863
  //#endregion
4852
4864
  //#region src/adapters/dsh-filesystem/context-filesystem.d.ts
@@ -4855,28 +4867,6 @@ interface DshContextFileSystemTarget {
4855
4867
  readonly displayPath: string;
4856
4868
  }
4857
4869
  //#endregion
4858
- //#region src/adapters/dsh-connection/observe-summary-rpc.d.ts
4859
- type ObserveRpcError = {
4860
- readonly code: string;
4861
- readonly message: string;
4862
- readonly details: Record<string, unknown>;
4863
- };
4864
- type ObserveRpcResult<T> = {
4865
- readonly ok: true;
4866
- readonly value: T;
4867
- } | {
4868
- readonly ok: false;
4869
- readonly error: ObserveRpcError;
4870
- };
4871
- type ObserveSummaryRpcHandler = (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<ObserveRpcResult<unknown>>;
4872
- interface ObserveSummaryHostConnection {
4873
- readonly rpc: {
4874
- handle(channel: string, handler: ObserveSummaryRpcHandler, options: {
4875
- readonly authority: 'loopback';
4876
- }): () => Promise<void>;
4877
- };
4878
- }
4879
- //#endregion
4880
4870
  //#region src/application/automatic-learning-policy.d.ts
4881
4871
  interface AutomaticLearningSnapshot {
4882
4872
  readonly automaticLearning: boolean;
@@ -5519,6 +5509,12 @@ interface StockPluginRuntimeProjection {
5519
5509
  interface StockPresetMountProjection {
5520
5510
  readonly presetId: string;
5521
5511
  readonly fiber: StockFiberProjection;
5512
+ readonly key?: object | undefined;
5513
+ readonly tree?: {
5514
+ readonly root: {
5515
+ readonly data: unknown;
5516
+ };
5517
+ } | undefined;
5522
5518
  }
5523
5519
  interface StockPresetMountPort {
5524
5520
  standingMountFor(agentContext: object): StockPresetMountProjection | undefined | Promise<StockPresetMountProjection | undefined>;
@@ -5531,32 +5527,26 @@ interface StockComposedAgentProjection {
5531
5527
  readonly get?: (name: string) => unknown;
5532
5528
  };
5533
5529
  }
5534
- interface StockAgentPresetObservationPort {
5535
- composedPreset(agentContext: object): string | undefined;
5536
- resolve(id: string): Promise<{
5537
- readonly id: string;
5538
- readonly trust: 'system' | 'user';
5539
- }>;
5540
- read(id: string): Promise<string>;
5541
- }
5542
- declare function resolvePinnedStockPresetConfiguration(presets: StockAgentPresetObservationPort, agent: {
5543
- readonly ctx: object;
5544
- }, expectedDigests?: Readonly<Record<'standard' | 'code', readonly string[]>>): Promise<StockSkillRuntimeConfiguration | undefined>;
5545
5530
  /** Reads the exact stock filesystem fiber mounted for one Agent's joined generation. */
5546
- declare function resolveStockSkillRuntimeConfiguration(mounts: StockPresetMountPort, agent: StockComposedAgentProjection): Promise<StockSkillRuntimeConfiguration | undefined>;
5531
+ declare function resolveStockSkillRuntimeConfiguration(mounts: StockPresetMountPort, agent: StockComposedAgentProjection, expectedDigest?: string): Promise<StockSkillRuntimeConfiguration | undefined>;
5547
5532
  //#endregion
5548
- //#region src/adapters/dsh-settings/automatic-learning.d.ts
5549
- interface DshSettingsScope<T> {
5550
- get(): T;
5551
- watch(callback: (next: T, previous: T) => void | Promise<void>): () => void;
5533
+ //#region src/adapters/dsh-skills/stock-cold-preset.d.ts
5534
+ interface StockPresetLease {
5535
+ readonly key: object;
5536
+ [Symbol.asyncDispose](): Promise<void>;
5552
5537
  }
5553
- interface DshSettingsPort {
5554
- register<T>(namespace: string, schema: z$1<T>, options: {
5555
- readonly applies: 'live';
5556
- }): DshSettingsScope<T>;
5538
+ interface StockColdPresetRegistry {
5539
+ acquireScope(id: string): Promise<StockPresetLease>;
5540
+ }
5541
+ //#endregion
5542
+ //#region src/adapters/dsh-settings/automatic-learning.d.ts
5543
+ interface AutomaticLearningConfig {
5544
+ readonly automaticLearning: {
5545
+ get(): boolean;
5546
+ };
5557
5547
  }
5558
5548
  interface AutomaticLearningSettingsPolicy extends AutomaticLearningPolicyPort {
5559
- watch(callback: (next: AutomaticLearningSnapshot, previous: AutomaticLearningSnapshot) => void | Promise<void>): () => void;
5549
+ watch(callback: (next: AutomaticLearningSnapshot, previous: AutomaticLearningSnapshot) => void): () => void;
5560
5550
  }
5561
5551
  //#endregion
5562
5552
  //#region src/application/purge/purge-service.d.ts
@@ -5716,20 +5706,21 @@ declare class PublicationTargetSingleFlight {
5716
5706
  //#endregion
5717
5707
  //#region src/host/index.d.ts
5718
5708
  declare const name = "run2skill";
5719
- declare const inject: readonly ["agents", "sessions", "sessionPersistence", "storageDomain", "workspaceRegistry", "connection", "llm", "skills", "settings", "agentPresets", "fs"];
5709
+ declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<NoInfer<{
5710
+ automaticLearning: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
5711
+ }>>, Schemastery.ObjectT<NoInfer<{
5712
+ automaticLearning: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
5713
+ }>>, "plain">;
5714
+ declare const inject: readonly ["agents", "sessions", "sessionPersistence", "storageDomain", "workspaceRegistry", "llm", "skills", "agentPresets", "fs"];
5720
5715
  type Run2skillAgent = object & AgentScopeProjection & Parameters<typeof resolveStockSkillRuntimeConfiguration>[1];
5721
- type Run2skillAgentPresets = Parameters<typeof resolvePinnedStockPresetConfiguration>[0] & {
5722
- standingKeyFor(id?: string): Promise<object>;
5723
- };
5716
+ type Run2skillAgentPresets = StockColdPresetRegistry;
5724
5717
  interface Run2skillHostContext extends Run2skillStorageContext {
5725
5718
  readonly agents: unknown;
5726
5719
  readonly sessions: unknown;
5727
- readonly sessionPersistence: SessionPersistencePort;
5720
+ readonly sessionPersistence: DshSessionPersistencePort;
5728
5721
  readonly workspaceRegistry: DshWorkspaceRegistryPort;
5729
- readonly connection: ObserveSummaryHostConnection;
5730
5722
  readonly llm: DshLlmPort;
5731
5723
  readonly skills: DshSkillRegistryPort<LearningSkillView<Run2skillAgent>>;
5732
- readonly settings: DshSettingsPort;
5733
5724
  readonly agentPresets: Run2skillAgentPresets;
5734
5725
  /** Host-plane DSH filesystem used by the supported web presets. */
5735
5726
  readonly fs: unknown;
@@ -5763,6 +5754,6 @@ declare class Run2skillRuntimeFactory implements RecoveryRuntimeFactory {
5763
5754
  resolvePurgeScope(scope: 'PROJECT' | 'USER', workspaceId?: string): Promise<PurgeScopeBindingV1>;
5764
5755
  open(): Promise<RecoveryRuntime>;
5765
5756
  }
5766
- declare function apply(context: Run2skillHostContext): Promise<() => Promise<void>>;
5757
+ declare function apply(context: Run2skillHostContext, config: AutomaticLearningConfig): Promise<() => Promise<void>>;
5767
5758
  //#endregion
5768
- export { ApprovalPublicationSaga, ApprovalPublicationSagaOptions, ApprovedProposalRevalidator, PublicationConflict, PublicationFileSystemPort, PublicationFileSystemResult, PublicationReadbackPort, PublicationReadbackResult, PublicationRevalidationPort, PublicationRevalidationResult, PublicationRootPreparation, PublicationScheduler, PublicationSchedulerOptions, PublicationSingleFlightPort, PublicationTargetSingleFlight, PublicationWorkerPort, Run2skillHostContext, Run2skillRuntimeFactory, V2ProposalPublicationCoordinator, V2ProposalPublicationError, V2ProposalPublicationInput, V2ProposalPublicationOptions, V2ProposalPublicationOutcome, V2ProposalPublicationRecoveryOutcome, V2ProposalPublicationRequest, V2ProposalPublicationResult, apply, createBundle, finalizeTransaction, inject, mergeBundle, name, preparePublicationRoot, recoverTransaction };
5759
+ export { ApprovalPublicationSaga, ApprovalPublicationSagaOptions, ApprovedProposalRevalidator, Config, PublicationConflict, PublicationFileSystemPort, PublicationFileSystemResult, PublicationReadbackPort, PublicationReadbackResult, PublicationRevalidationPort, PublicationRevalidationResult, PublicationRootPreparation, PublicationScheduler, PublicationSchedulerOptions, PublicationSingleFlightPort, PublicationTargetSingleFlight, PublicationWorkerPort, Run2skillHostContext, Run2skillRuntimeFactory, V2ProposalPublicationCoordinator, V2ProposalPublicationError, V2ProposalPublicationInput, V2ProposalPublicationOptions, V2ProposalPublicationOutcome, V2ProposalPublicationRecoveryOutcome, V2ProposalPublicationRequest, V2ProposalPublicationResult, apply, createBundle, finalizeTransaction, inject, mergeBundle, name, preparePublicationRoot, recoverTransaction };