@qilin-agent/tmux-context 3.1.4 → 3.1.6

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.
Files changed (2) hide show
  1. package/lib/index.js +61 -19
  2. package/package.json +15 -15
package/lib/index.js CHANGED
@@ -53,7 +53,7 @@ const REMOTE_METHOD_DESCRIPTOR = "@qilin-agent/typert-protocol/remote-methods";
53
53
  * a Host composition to read it.
54
54
  * @param service - owning Service instance, normally `this`.
55
55
  * @param serviceKey - exact Cordis service key.
56
- * @param options - optional distinct wire namespace.
56
+ * @param options - optional wire namespace.
57
57
  * @returns a frozen, inspectable binding with no compiler-injected metadata.
58
58
  */
59
59
  function bindTypertRemote(service, serviceKey, options = {}) {
@@ -61,7 +61,7 @@ function bindTypertRemote(service, serviceKey, options = {}) {
61
61
  const namespace = options.namespace ?? serviceKey;
62
62
  validateName("namespace", namespace);
63
63
  const ctx = Reflect.get(service, "ctx");
64
- if (ctx instanceof Context) provideInvocationAccessor(ctx);
64
+ if (Context.is(ctx)) provideInvocationAccessor(ctx);
65
65
  return Object.freeze({
66
66
  service,
67
67
  serviceKey,
@@ -76,7 +76,7 @@ var TypertRemoteService = class extends Service {
76
76
  * Register the Service and bind the same key to Typert Gateway.
77
77
  * @param ctx - owning Cordis Context.
78
78
  * @param serviceKey - exact Cordis service key and default wire namespace.
79
- * @param options - optional distinct wire namespace.
79
+ * @param options - optional wire namespace.
80
80
  */
81
81
  constructor(ctx, serviceKey, options = {}) {
82
82
  super(ctx, serviceKey);
@@ -96,21 +96,42 @@ function provideInvocationAccessor(ctx) {
96
96
  function Remote(methodExportOrOptions, context) {
97
97
  if (typeof methodExportOrOptions === "string") {
98
98
  validateName("Remote export name", methodExportOrOptions);
99
- return remoteDecorator({ kind: "direct" }, void 0, methodExportOrOptions);
100
- }
101
- if (typeof methodExportOrOptions === "object") {
102
- if (remoteOptionMode(methodExportOrOptions) !== "stream" || Reflect.ownKeys(methodExportOrOptions).length !== 1) throw new TypeError("typert-protocol: Remote options must contain exactly mode: \"stream\"");
103
- return remoteDecorator({ kind: "direct" }, "stream");
99
+ return remoteDecorator({ kind: "direct" }, { exportName: methodExportOrOptions });
104
100
  }
101
+ if (typeof methodExportOrOptions === "object") return remoteDecorator({ kind: "direct" }, markerOptions(methodExportOrOptions, REMOTE_OPTION_KEYS, "Remote options require name, mode: \"stream\", or resources"));
105
102
  if (context === void 0) throw new TypeError("typert-protocol: Remote decorator context is missing");
106
103
  addMarkerInitializer(context, { kind: "direct" });
107
104
  }
108
- function remoteOptionMode(options) {
109
- return Reflect.get(options, "mode");
105
+ const REMOTE_OPTION_KEYS = new Set([
106
+ "name",
107
+ "mode",
108
+ "resources"
109
+ ]);
110
+ /** Validate one decorator options object against its accepted keys and select the marker fields. */
111
+ function markerOptions(options, accepted, requirement) {
112
+ const keys = Reflect.ownKeys(options);
113
+ if (keys.length === 0 || keys.some((key) => typeof key !== "string" || !accepted.has(key)) || Object.hasOwn(options, "mode") && options.mode !== "stream") throw new TypeError(`typert-protocol: ${requirement}`);
114
+ const { mode, name, resources } = options;
115
+ if (name !== void 0) validateName("Remote export name", name);
116
+ return {
117
+ ...mode === void 0 ? {} : { mode },
118
+ ...name === void 0 ? {} : { exportName: name },
119
+ ...resources === void 0 ? {} : { resources: resourceReaders(resources) }
120
+ };
110
121
  }
111
- function remoteDecorator(invocation, mode, exportName) {
122
+ /** Freeze declared readers into the marker record; a misdeclared reader fails at decoration. */
123
+ function resourceReaders(resources) {
124
+ const readers = {};
125
+ for (const [kind, reader] of Object.entries(resources)) {
126
+ if (typeof reader !== "function") throw new TypeError(`typert-protocol: Remote resource reader "${kind}" must be a function`);
127
+ readers[kind] = reader;
128
+ }
129
+ if (Object.keys(readers).length === 0) throw new TypeError("typert-protocol: Remote resources require at least one reader");
130
+ return Object.freeze(readers);
131
+ }
132
+ function remoteDecorator(invocation, options = {}) {
112
133
  return function(_method, context) {
113
- addMarkerInitializer(context, invocation, mode, exportName);
134
+ addMarkerInitializer(context, invocation, options);
114
135
  };
115
136
  }
116
137
  function readRemoteMethodDescriptor(prototype) {
@@ -124,26 +145,27 @@ function readRemoteMethodDescriptor(prototype) {
124
145
  if (!Array.isArray(methods)) throw new TypeError("typert-protocol: Remote method descriptor methods must be an array");
125
146
  return descriptor;
126
147
  }
127
- function addMarkerInitializer(context, invocation, mode, exportName) {
148
+ function addMarkerInitializer(context, invocation, options = {}) {
128
149
  if (context.private || context.static || typeof context.name !== "string") throw new TypeError("typert-protocol: Remote decorators require a public instance method with a string name");
129
150
  const method = context.name;
130
151
  context.addInitializer(function() {
131
152
  const prototype = Object.getPrototypeOf(this);
132
153
  if (prototype === null) throw new TypeError(`typert-protocol: cannot mark Remote method "${method}" on an object without a prototype`);
133
- mark(prototype, method, invocation, mode, exportName);
154
+ mark(prototype, method, invocation, options);
134
155
  });
135
156
  }
136
- function mark(prototype, method, invocation, mode, exportName) {
157
+ function mark(prototype, method, invocation, { mode, exportName, resources }) {
137
158
  const descriptor = readRemoteMethodDescriptor(prototype);
138
159
  const marker = Object.freeze({
139
160
  method,
140
161
  ...exportName === void 0 || exportName === method ? {} : { exportName },
141
162
  ...mode === void 0 ? {} : { mode },
142
- invocation: Object.freeze(invocation)
163
+ invocation: Object.freeze(invocation),
164
+ ...resources === void 0 ? {} : { resources }
143
165
  });
144
166
  const current = descriptor?.methods.find((candidate) => candidate.method === method);
145
167
  if (current !== void 0) {
146
- if (current.exportName === marker.exportName && current.mode === marker.mode && sameInvocation(current.invocation, invocation)) return;
168
+ if (current.exportName === marker.exportName && current.mode === marker.mode && current.resources === marker.resources && sameInvocation(current.invocation, invocation)) return;
147
169
  throw new Error(`typert-protocol: Remote method "${method}" has conflicting invocation markers`);
148
170
  }
149
171
  Object.defineProperty(prototype, REMOTE_METHOD_DESCRIPTOR, {
@@ -1599,7 +1621,12 @@ var LlmError = class extends HarnessError {
1599
1621
  if (this.directory.has(entry.provider) && !own.has(entry.provider) || detached.some((seen) => seen.provider === entry.provider)) throw new LlmError(`configurable provider "${entry.provider}" is already declared`, "DUPLICATE_DIRECTORY");
1600
1622
  detached.push({
1601
1623
  ...entry,
1602
- settingsPath: [...entry.settingsPath]
1624
+ settingsPath: [...entry.settingsPath],
1625
+ ...entry.baseURLEnv === void 0 ? {} : { baseURLEnv: [...entry.baseURLEnv] },
1626
+ ...entry.nativeAuth === void 0 ? {} : { nativeAuth: {
1627
+ ...entry.nativeAuth,
1628
+ env: [...entry.nativeAuth.env]
1629
+ } }
1603
1630
  });
1604
1631
  }
1605
1632
  for (const entry of held) this.directory.delete(entry.provider);
@@ -1631,7 +1658,12 @@ var LlmError = class extends HarnessError {
1631
1658
  listConfigurableProviders() {
1632
1659
  return [...this.directory.values()].map((entry) => ({
1633
1660
  ...entry,
1634
- settingsPath: [...entry.settingsPath]
1661
+ settingsPath: [...entry.settingsPath],
1662
+ ...entry.baseURLEnv === void 0 ? {} : { baseURLEnv: [...entry.baseURLEnv] },
1663
+ ...entry.nativeAuth === void 0 ? {} : { nativeAuth: {
1664
+ ...entry.nativeAuth,
1665
+ env: [...entry.nativeAuth.env]
1666
+ } }
1635
1667
  }));
1636
1668
  }
1637
1669
  /**
@@ -1724,6 +1756,16 @@ var LlmError = class extends HarnessError {
1724
1756
  return this.adapters.get(provider)?.adapter.imageRequestPricing(provider, model);
1725
1757
  }
1726
1758
  /**
1759
+ * Resolve the image projection for an exact registered model route.
1760
+ * @param provider - registered provider route.
1761
+ * @param model - exact model id.
1762
+ * @param image - normalized image reference.
1763
+ * @returns dimensions and byte target used by the adapter's request serializer.
1764
+ */
1765
+ imageRequestTarget(provider, model, image) {
1766
+ return this.registration(provider).adapter.imageRequestTarget(provider, model, image);
1767
+ }
1768
+ /**
1727
1769
  * Resolve the exact text one durable file occurrence contributes to every
1728
1770
  * provider request in the current execution environment.
1729
1771
  * @param ref - durable verbatim file reference from model history.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/tmux-context",
3
3
  "description": "Opt-in durable per-step context with this agent's tmux pane and window location",
4
- "version": "3.1.4",
4
+ "version": "3.1.6",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,23 +31,23 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "zod": "^4.4.3",
34
- "@qilin-agent/schemastery": "~3.18.3"
34
+ "@qilin-agent/schemastery": "~3.18.5"
35
35
  },
36
36
  "peerDependencies": {
37
- "@qilin-agent/shell": "3.1.4",
38
- "@qilin-agent/kylin": "~4.0.3",
39
- "@qilin-agent/session": "3.1.4",
40
- "@qilin-agent/session-projection": "3.1.4",
41
- "@qilin-agent/agent": "3.1.4"
37
+ "@qilin-agent/shell": "3.1.6",
38
+ "@qilin-agent/session-projection": "3.1.6",
39
+ "@qilin-agent/kylin": "~4.0.5",
40
+ "@qilin-agent/agent": "3.1.6",
41
+ "@qilin-agent/session": "3.1.6"
42
42
  },
43
43
  "devDependencies": {
44
- "@qilin-agent/shell": "3.1.4",
45
- "@qilin-agent/agent-loop-testkit": "3.1.4",
46
- "@qilin-agent/session": "3.1.4",
47
- "@qilin-agent/llm": "3.1.4",
48
- "@qilin-agent/agent": "3.1.4",
49
- "@qilin-agent/system-prompt": "3.1.4",
50
- "@qilin-agent/kylin": "~4.0.3",
51
- "@qilin-agent/session-projection": "3.1.4"
44
+ "@qilin-agent/agent": "3.1.6",
45
+ "@qilin-agent/shell": "3.1.6",
46
+ "@qilin-agent/session": "3.1.6",
47
+ "@qilin-agent/llm": "3.1.6",
48
+ "@qilin-agent/system-prompt": "3.1.6",
49
+ "@qilin-agent/agent-loop-testkit": "3.1.6",
50
+ "@qilin-agent/kylin": "~4.0.5",
51
+ "@qilin-agent/session-projection": "3.1.6"
52
52
  }
53
53
  }