@slopus/happy-agent-base 0.0.4 → 0.0.5

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.
@@ -1,4 +1,5 @@
1
1
  import { createContextNamespace } from "@steve.kite/stdlib";
2
+ import { DEFAULT_AGENT_PERMISSION_MODE } from "./AgentPermissionMode.js";
2
3
  /** Backing storage for `agentId`: the ID of the agent owning a context. */
3
4
  const idNamespace = createContextNamespace("agentId", undefined);
4
5
  /** Backing storage for `agentModel`: the model configured for the agent, when one was set. */
@@ -9,23 +10,26 @@ const effortNamespace = createContextNamespace("agentEffort", undefined);
9
10
  const providerNamespace = createContextNamespace("agentProvider", undefined);
10
11
  /** Backing storage for `agentServiceTier`: the service tier configured, when one was set. */
11
12
  const serviceTierNamespace = createContextNamespace("agentServiceTier", undefined);
13
+ /** Backing storage for `agentPermissionMode`: how much the work on a context may touch. */
14
+ const permissionModeNamespace = createContextNamespace("agentPermissionMode", DEFAULT_AGENT_PERMISSION_MODE);
12
15
  /** Backing storage for `agentKV`: the scoped key-value store carried on a context. */
13
16
  const kvNamespace = createContextNamespace("agentKV", undefined);
14
17
  /** Backing storage for `agentRunKV`: the run's own store, erased when the agent settles. */
15
18
  const runKVNamespace = createContextNamespace("agentRunKV", undefined);
16
19
  /**
17
- * Derive the agent's context carrying its ID, provider ID, model, effort, and service tier — all
18
- * serializable values. The agent applies this once at construction, so hooks and tool executions
19
- * can read the values back through the accessors below. The ID is what lets one feature instance
20
- * serve every agent in a collection: a shared feature learns which agent a hook is running for
21
- * from the context rather than from something it was constructed with.
20
+ * Derive the agent's context carrying its ID, provider ID, model, effort, service tier, and
21
+ * permission mode — all serializable values. The agent applies this once at construction, so hooks
22
+ * and tool executions can read the values back through the accessors below. The ID is what lets one
23
+ * feature instance serve every agent in a collection: a shared feature learns which agent a hook is
24
+ * running for from the context rather than from something it was constructed with.
22
25
  */
23
26
  export function withAgentContext(ctx, values) {
24
27
  const withId = idNamespace.set(ctx, values.id);
25
28
  const withProvider = providerNamespace.set(withId, values.provider);
26
29
  const withModel = modelNamespace.set(withProvider, values.model);
27
30
  const withEffort = effortNamespace.set(withModel, values.effort);
28
- return serviceTierNamespace.set(withEffort, values.serviceTier);
31
+ const withTier = serviceTierNamespace.set(withEffort, values.serviceTier);
32
+ return permissionModeNamespace.set(withTier, values.permissionMode);
29
33
  }
30
34
  /** The ID of the agent owning this context. */
31
35
  export function agentId(ctx) {
@@ -47,6 +51,22 @@ export function agentProvider(ctx) {
47
51
  export function agentServiceTier(ctx) {
48
52
  return serviceTierNamespace.get(ctx);
49
53
  }
54
+ /**
55
+ * How much the work on this context may touch. It is the mode the agent is running in, unless a
56
+ * narrower scope replaced it for one execution.
57
+ */
58
+ export function agentPermissionMode(ctx) {
59
+ return permissionModeNamespace.get(ctx);
60
+ }
61
+ /**
62
+ * Run one stretch of work under another mode. This is how an allowed Auto action is lent the access
63
+ * it was reviewed for: the work derived from this context sees the wider mode, and everything
64
+ * outside it goes on seeing the agent's own. Deriving from a context the agent handed out is what
65
+ * keeps the rest of that context — the agent's identity, its stores, its lifetime — intact.
66
+ */
67
+ export function withAgentPermissionMode(ctx, mode) {
68
+ return permissionModeNamespace.set(ctx, mode);
69
+ }
50
70
  /** Carry a scoped key-value store on the context, replacing any store carried before. */
51
71
  export function withAgentKV(ctx, kv) {
52
72
  return kvNamespace.set(ctx, kv);
@@ -1 +1 @@
1
- {"version":3,"file":"AgentContexts.js","sourceRoot":"","sources":["../sources/AgentContexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAgB,MAAM,oBAAoB,CAAC;AAI1E,2EAA2E;AAC3E,MAAM,WAAW,GAAG,sBAAsB,CAAqB,SAAS,EAAE,SAAS,CAAC,CAAC;AACrF,8FAA8F;AAC9F,MAAM,cAAc,GAAG,sBAAsB,CAAqB,YAAY,EAAE,SAAS,CAAC,CAAC;AAC3F,4FAA4F;AAC5F,MAAM,eAAe,GAAG,sBAAsB,CAC1C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oningEffort, SessionServiceTier, SessionSystemMessage } from "@slopus/happy-providers";
1
+ import type { ProviderModelCompatibilityType, SessionEvent, SessionReasoningEffort, SessionServiceTier, SessionSystemMessage, SessionToolCallBlock, SessionToolResultMessage } from "@slopus/happy-providers";
2
2
  import type { Context } from "@steve.kite/stdlib";
3
- import type { AgentBaseInference, AgentBaseModelChange, AgentBasePersistedEvent, AgentBaseToolExecution, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
3
+ import type { AgentBaseAcceptedMessage, AgentBaseInference, AgentBaseModelChange, AgentBasePermissionModeChange, AgentBasePersistedEvent, AgentBaseToolCall, AgentBaseToolCallDecision, AgentBaseToolOutcome, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
4
4
  import type { AgentFeatureAction } from "./AgentFeatureAction.js";
5
5
  import type { AgentKV } from "./AgentKV.js";
6
+ import type { AgentPermissionMode } from "./AgentPermissionMode.js";
6
7
  import type { AgentSystemRef } from "./AgentSystemRef.js";
7
8
  import type { AnyAgentTool } from "./AgentTool.js";
8
9
  /**
@@ -27,6 +28,12 @@ export interface AgentFeatureAgent {
27
28
  readonly effort: SessionReasoningEffort | undefined;
28
29
  /** The service tier in force, absent when none was ever selected. */
29
30
  readonly tier: SessionServiceTier | undefined;
31
+ /**
32
+ * How much of the machine the agent may touch. The runtime carries it and makes its changes
33
+ * durable but enforces nothing, so a feature whose tools act on the machine is what decides
34
+ * what this mode actually permits.
35
+ */
36
+ readonly permissionMode: AgentPermissionMode;
30
37
  }
31
38
  /**
32
39
  * What every hook of a feature is handed alongside the context: which agent it is running for,
@@ -93,12 +100,36 @@ export interface AgentFeature<Tool extends AnyAgentTool = AnyAgentTool> {
93
100
  /** Merged after the base state and every earlier feature's tools, in feature order. */
94
101
  readonly tools?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<readonly Tool[]>;
95
102
  /**
96
- * Wraps validated tool execution. Features compose as nested middleware in array order.
97
- * See `AgentBaseHooks.aroundToolExecution` for the continuation contract.
103
+ * Runs inside the transaction that makes a dispatched batch durable, once per call in it.
104
+ * Features run in array order and a failure propagates, rolling the dispatch back.
105
+ */
106
+ readonly beforeToolCallTransact?: (ctx: Context, scope: AgentFeatureScope, call: SessionToolCallBlock) => MaybePromise<void>;
107
+ /**
108
+ * Decides what to do with one validated call before it runs. Features are asked in array
109
+ * order: what one of them amends is what the next one sees, and the first to answer the model
110
+ * settles the call and ends the chain.
98
111
  */
99
- readonly aroundToolExecution?: (ctx: Context, scope: AgentFeatureScope, execution: AgentBaseToolExecution) => MaybePromise<unknown>;
112
+ readonly beforeToolCall?: (ctx: Context, scope: AgentFeatureScope, call: AgentBaseToolCall) => MaybePromise<AgentBaseToolCallDecision | undefined>;
113
+ /** Observes what one call produced, before its result is committed. */
114
+ readonly afterToolCall?: (ctx: Context, scope: AgentFeatureScope, outcome: AgentBaseToolOutcome) => MaybePromise<void>;
115
+ /**
116
+ * Runs inside the transaction appending one tool result to the durable conversation. Features
117
+ * run in array order and a failure propagates, rolling that commit back.
118
+ */
119
+ readonly afterToolCallTransact?: (ctx: Context, scope: AgentFeatureScope, result: SessionToolResultMessage) => MaybePromise<void>;
100
120
  /** The first feature that returns a handoff message wins the reset injection. */
101
121
  readonly modelChanged?: (ctx: Context, scope: AgentFeatureScope, change: AgentBaseModelChange) => MaybePromise<SessionSystemMessage | undefined>;
122
+ /**
123
+ * Runs inside the transaction appending a queued message to the durable conversation, once per
124
+ * message. Features run in array order and a failure propagates, rolling the consumption back.
125
+ */
126
+ readonly messageAcceptedTransact?: (ctx: Context, scope: AgentFeatureScope, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
127
+ /** Observes the same messages once the consumption has committed. */
128
+ readonly messageAccepted?: (ctx: Context, scope: AgentFeatureScope, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
129
+ /** Transactional counterpart to `permissionModeChanged`; a failure rolls the change back. */
130
+ readonly permissionModeChangedTransact?: (ctx: Context, scope: AgentFeatureScope, change: AgentBasePermissionModeChange) => MaybePromise<void>;
131
+ /** Observes a permission-mode change a consumed message made, once it is durable. */
132
+ readonly permissionModeChanged?: (ctx: Context, scope: AgentFeatureScope, change: AgentBasePermissionModeChange) => MaybePromise<void>;
102
133
  /** Transactional counterpart to `beforeAgentLoop`. */
103
134
  readonly beforeAgentLoopTransact?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
104
135
  /** Called when the loop leaves the settled state and begins working. */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentFeature.d.ts","sourceRoot":"","sources":["../sources/AgentFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,8BAA8B,EAC9B,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EACR,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,8BAA8B,GAAG,SAAS,CAAC;IAClE,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC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AAY,CAAC,IAAI,CAAC,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,cAAc,CAAC,EAAE,CACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,iBAAiB,KACvB,YAAY,CAAC,SAAS,kBAAkB,EAAE,GAAG,SAAS,CAAC,CAAC;IAC7D;;;;;;;;;OASG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,iBAAiB,KACvB,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC/F"}
@@ -0,0 +1,27 @@
1
+ import { type Static } from "@sinclair/typebox";
2
+ /**
3
+ * How much of the machine an agent is allowed to touch, as one of four modes.
4
+ *
5
+ * The mode is part of what an agent is running on, exactly like its model: it is carried on every
6
+ * context the agent derives, it is durable, and a message may change it. What the runtime does not
7
+ * do is enforce it — the loop has no idea what any particular tool touches. Enforcement belongs to
8
+ * the features and tools that know, and they read the mode in force from the context they are
9
+ * given.
10
+ */
11
+ export declare const agentPermissionModeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"read_only">, import("@sinclair/typebox").TLiteral<"workspace_write">, import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"full_access">]>;
12
+ /** The TypeScript type inferred from {@link agentPermissionModeSchema}. */
13
+ export type AgentPermissionMode = Static<typeof agentPermissionModeSchema>;
14
+ /**
15
+ * The mode an agent runs in when nobody has said otherwise. Auto is the product's default: work
16
+ * happens in the sandbox, and the one action that has to leave it is reviewed rather than refused.
17
+ */
18
+ export declare const DEFAULT_AGENT_PERMISSION_MODE: AgentPermissionMode;
19
+ /**
20
+ * Whether a value is one of the four modes. Durable state is read back through this rather than
21
+ * trusted, so a store holding something else falls back to the mode the agent was built with
22
+ * instead of running under a mode nothing can interpret.
23
+ */
24
+ export declare function isAgentPermissionMode(value: unknown): value is AgentPermissionMode;
25
+ /** The mode's name in the words a person reads, for anything shown to a person or a model. */
26
+ export declare function agentPermissionModeLabel(mode: AgentPermissionMode): string;
27
+ //# sourceMappingURL=AgentPermissionMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentPermissionMode.d.ts","sourceRoot":"","sources":["../sources/AgentPermissionMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,qPAYrC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,mBAA4B,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAW1E"}
@@ -0,0 +1,48 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Value } from "@sinclair/typebox/value";
3
+ /**
4
+ * How much of the machine an agent is allowed to touch, as one of four modes.
5
+ *
6
+ * The mode is part of what an agent is running on, exactly like its model: it is carried on every
7
+ * context the agent derives, it is durable, and a message may change it. What the runtime does not
8
+ * do is enforce it — the loop has no idea what any particular tool touches. Enforcement belongs to
9
+ * the features and tools that know, and they read the mode in force from the context they are
10
+ * given.
11
+ */
12
+ export const agentPermissionModeSchema = Type.Union([
13
+ /** Inspection only: nothing may be changed and the shell reaches no network. */
14
+ Type.Literal("read_only"),
15
+ /** Changes inside the workspace, with shell network and outside writes still blocked. */
16
+ Type.Literal("workspace_write"),
17
+ /** The workspace sandbox, plus a review that may allow one action to cross it. */
18
+ Type.Literal("auto"),
19
+ /** No filesystem, shell, or network restriction of Rig's own. */
20
+ Type.Literal("full_access"),
21
+ ], { description: "How much of the machine the agent may touch." });
22
+ /**
23
+ * The mode an agent runs in when nobody has said otherwise. Auto is the product's default: work
24
+ * happens in the sandbox, and the one action that has to leave it is reviewed rather than refused.
25
+ */
26
+ export const DEFAULT_AGENT_PERMISSION_MODE = "auto";
27
+ /**
28
+ * Whether a value is one of the four modes. Durable state is read back through this rather than
29
+ * trusted, so a store holding something else falls back to the mode the agent was built with
30
+ * instead of running under a mode nothing can interpret.
31
+ */
32
+ export function isAgentPermissionMode(value) {
33
+ return Value.Check(agentPermissionModeSchema, value);
34
+ }
35
+ /** The mode's name in the words a person reads, for anything shown to a person or a model. */
36
+ export function agentPermissionModeLabel(mode) {
37
+ switch (mode) {
38
+ case "read_only":
39
+ return "Read only";
40
+ case "workspace_write":
41
+ return "Workspace write";
42
+ case "auto":
43
+ return "Auto";
44
+ case "full_access":
45
+ return "Full access";
46
+ }
47
+ }
48
+ //# sourceMappingURL=AgentPermissionMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentPermissionMode.js","sourceRoot":"","sources":["../sources/AgentPermissionMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAC/C;IACI,gFAAgF;IAChF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACzB,yFAAyF;IACzF,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAC/B,kFAAkF;IAClF,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,iEAAiE;IACjE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;CAC9B,EACD,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAClE,CAAC;AAKF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB,MAAM,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAChD,OAAO,KAAK,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,wBAAwB,CAAC,IAAyB;IAC9D,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,WAAW;YACZ,OAAO,WAAW,CAAC;QACvB,KAAK,iBAAiB;YAClB,OAAO,iBAAiB,CAAC;QAC7B,KAAK,MAAM;YACP,OAAO,MAAM,CAAC;QAClB,KAAK,aAAa;YACd,OAAO,aAAa,CAAC;IAC7B,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,10 +11,11 @@ export { AgentStorage, type AgentStorageLock, type AgentStorageOptions } from ".
11
11
  export { type AgentModel } from "./AgentModel.js";
12
12
  export { knownModels, type Model } from "./models.js";
13
13
  export { AgentBase, type AgentBaseAwaitOptions, type AgentBaseMessageOptions, type AgentBaseOptions, type AgentBaseQueueMode, } from "./AgentBase.js";
14
- export { agentEffort, agentId, agentKV, agentModel, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentRunKV, } from "./AgentContexts.js";
14
+ export { agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
15
+ export { agentPermissionModeLabel, agentPermissionModeSchema, isAgentPermissionMode, DEFAULT_AGENT_PERMISSION_MODE, type AgentPermissionMode, } from "./AgentPermissionMode.js";
15
16
  export { agentTaskContext, taskContextBeforeToolCall, withAgentTaskContext, } from "./AgentTaskContext.js";
16
17
  export { AgentKV } from "./AgentKV.js";
17
- export { type AgentBaseHooks, type AgentBaseInference, type AgentBaseModelChange, type AgentBasePersistedEvent, type AgentBaseToolExecution, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
18
+ export { type AgentBaseAcceptedMessage, type AgentBaseHooks, type AgentBaseInference, type AgentBaseModelChange, type AgentBasePermissionModeChange, type AgentBasePersistedEvent, type AgentBaseToolCall, type AgentBaseToolCallDecision, type AgentBaseToolOutcome, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
18
19
  export { type AgentPersistence, type AgentRecord } from "./AgentPersistence.js";
19
20
  export { agentBasePendingStateOf, agentBaseStoreOwesWork, AGENT_BASE_PENDING_KEY, type AgentBasePendingStage, type AgentBasePendingState, } from "./AgentBasePending.js";
20
21
  export { type AgentBaseState } from "./AgentBaseState.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sources/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGvE,OAAO,EACH,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACrB,MAAM,kBAAkB,CAA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lE,OAAO,EACH,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GAC3B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACH,eAAe,EACf,KAAK,SAAS,EACd,KAAK,sCAAsC,EAC3C,KAAK,gCAAgC,EACrC,KAAK,YAAY,GACpB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -15,7 +15,8 @@ export {} from "./AgentModel.js";
15
15
  export { knownModels } from "./models.js";
16
16
  // The run loop itself: its context carriers, key-value store, hook contracts, and persistence.
17
17
  export { AgentBase, } from "./AgentBase.js";
18
- export { agentEffort, agentId, agentKV, agentModel, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentRunKV, } from "./AgentContexts.js";
18
+ export { agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
19
+ export { agentPermissionModeLabel, agentPermissionModeSchema, isAgentPermissionMode, DEFAULT_AGENT_PERMISSION_MODE, } from "./AgentPermissionMode.js";
19
20
  export { agentTaskContext, taskContextBeforeToolCall, withAgentTaskContext, } from "./AgentTaskContext.js";
20
21
  export { AgentKV } from "./AgentKV.js";
21
22
  export {} from "./AgentBaseHooks.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../sources/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,8EAA8E;AAC9E,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA4B,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAgC,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC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C;AAC7B,OAAO,EAA2C,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GAGzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAuB,MAAM,qBAAqB,CAAC;AAE1D,gGAAgG;AAChG,OAAO,EAIN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,MAAM,yBAAyB,CAAC;AAElE,6EAA6E;AAC7E,OAAO,EACH,cAAc,GAGjB,MAAM,qBAAqB,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EACH,eAAe,GAKlB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopus/happy-agent-base",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Durable runtime for Happy agents.",
5
5
  "license": "MIT",
6
6
  "repository": {