dsh-deeppilot 0.9.3 → 0.9.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.
package/lib/index.d.ts CHANGED
@@ -1048,7 +1048,7 @@ interface Config {
1048
1048
  maxConnectionsPerSource?: number;
1049
1049
  };
1050
1050
  /**
1051
- * Offline push (F-9). `apns` sends directly from the Mac with the user's
1051
+ * Offline push (F-9). `apns` sends directly from the computer with the user's
1052
1052
  * Apple credentials. `relay` sends notify projections to an operator-run
1053
1053
  * relay for distributed builds. The device reports its own APNs environment,
1054
1054
  * so development and TestFlight/App Store devices may coexist.
package/lib/index.js CHANGED
@@ -6908,6 +6908,25 @@ function projectSessionModels(value) {
6908
6908
  function inProcessRemoteRequest(input, init) {
6909
6909
  return new Request(new URL(input, "http://localhost/"), init);
6910
6910
  }
6911
+ /**
6912
+ * Install the Connection service on the resident Client.
6913
+ *
6914
+ * alpha.3 selects `interactions: 'none'` for any caller that supplies no page
6915
+ * location, and that mode forbids the forwarded-event stream this resident
6916
+ * client exists to answer. Only the explicit installer can name the
6917
+ * participation, so it takes precedence; `apply` stays for a host older than
6918
+ * the installer, reading the carrier from the process global set around it.
6919
+ */
6920
+ function installResidentConnection(connection, ctx, transport) {
6921
+ if (typeof connection.installConnection === "function") {
6922
+ connection.installConnection(ctx, {
6923
+ transport,
6924
+ interactions: "answer"
6925
+ });
6926
+ return;
6927
+ }
6928
+ connection.apply(ctx);
6929
+ }
6911
6930
  let clientFaces;
6912
6931
  /**
6913
6932
  * Load DSH's browser-distributed Client faces into a tiny Host-side module
@@ -6921,6 +6940,19 @@ function pluginModule(value, specifier) {
6921
6940
  if (typeof value.apply !== "function") throw new Error(`${specifier} has no Client apply() export`);
6922
6941
  return value;
6923
6942
  }
6943
+ /**
6944
+ * Register one loaded Client face when the browser banner did not.
6945
+ *
6946
+ * alpha.3 resolves these specifiers through the `node` export condition to a
6947
+ * bundle that exports the face as ordinary ESM and never calls
6948
+ * `window.__ModuleLoader__.load`, while earlier hosts only ship the banner
6949
+ * shape. A banner registration wins, because it is what the bundle's own
6950
+ * internal `require()` calls resolve against; the ESM namespace is the fallback.
6951
+ */
6952
+ function adoptClientModule(modules, specifier, loaded) {
6953
+ const id = specifier.replace(/\/client$/, "");
6954
+ if (!modules.has(id)) modules.set(id, loaded);
6955
+ }
6924
6956
  async function loadClientFaces() {
6925
6957
  clientFaces ??= (async () => {
6926
6958
  const modules = /* @__PURE__ */ new Map([["@deepseek-ai/cordis", Cordis]]);
@@ -6938,7 +6970,7 @@ async function loadClientFaces() {
6938
6970
  "@deepseek-ai/dsh-typert-registry/client",
6939
6971
  "@deepseek-ai/dsh-client-connection/client",
6940
6972
  "@deepseek-ai/dsh-api-gateway/client"
6941
- ]) await import(specifier);
6973
+ ]) adoptClientModule(modules, specifier, await import(specifier));
6942
6974
  } finally {
6943
6975
  if (previousWindow === void 0) delete loaderGlobal.window;
6944
6976
  else loaderGlobal.window = previousWindow;
@@ -6964,9 +6996,27 @@ function createAgentScope(ctx, identity) {
6964
6996
  }
6965
6997
  });
6966
6998
  }
6967
- function inProcessStream(gateway, endpoint, payload, signal) {
6999
+ /**
7000
+ * Mint the Peer every in-process carrier call speaks for.
7001
+ *
7002
+ * alpha.3 requires a Peer on `fetch` and on `wireStream.open`, and refuses a
7003
+ * forwarded-event stream unless that Peer declares `interactions: 'answer'`.
7004
+ * Its connection service therefore grows `createPeer`, the only entry point
7005
+ * that can name the principal and the participation together. Before that the
7006
+ * service holds one operator Peer and defaults every absent Peer to it, so that
7007
+ * instance is the drop-in answer. A host with neither yields undefined, which
7008
+ * only the pre-alpha.3 carrier accepts.
7009
+ */
7010
+ function createHostPeer(connection) {
7011
+ if (typeof connection.createPeer === "function") return connection.createPeer({
7012
+ principal: { kind: "owner" },
7013
+ interactions: "answer"
7014
+ });
7015
+ return connection.operator;
7016
+ }
7017
+ function inProcessStream(gateway, endpoint, payload, signal, peer) {
6968
7018
  return (async function* () {
6969
- yield* await gateway.wireStream.open(endpoint, payload, void 0, void 0, signal);
7019
+ yield* await gateway.wireStream.open(endpoint, payload, void 0, peer, signal);
6970
7020
  })();
6971
7021
  }
6972
7022
  /**
@@ -6983,10 +7033,11 @@ async function startDshRemoteInteractions(hostCtx, handlers) {
6983
7033
  if (gateway === void 0) throw new Error("DSH typertGateway is unavailable");
6984
7034
  const faces = await loadClientFaces();
6985
7035
  const client = new Context();
7036
+ const peer = createHostPeer(connection);
6986
7037
  const fetchHandler = connection.createSharedFetchHandler("/api");
6987
7038
  const transport = {
6988
- fetch: (input, init) => fetchHandler.fetch(inProcessRemoteRequest(input, init)),
6989
- openStream: (endpoint, payload, signal) => inProcessStream(gateway, endpoint, payload, signal),
7039
+ fetch: (input, init) => fetchHandler.fetch(inProcessRemoteRequest(input, init), peer),
7040
+ openStream: (endpoint, payload, signal) => inProcessStream(gateway, endpoint, payload, signal, peer),
6990
7041
  ownsHost: true
6991
7042
  };
6992
7043
  try {
@@ -6995,7 +7046,7 @@ async function startDshRemoteInteractions(hostCtx, handlers) {
6995
7046
  const previousTransport = transportGlobal.__DSH_TRANSPORT__;
6996
7047
  transportGlobal.__DSH_TRANSPORT__ = transport;
6997
7048
  try {
6998
- faces.connection.apply(client);
7049
+ installResidentConnection(faces.connection, client, transport);
6999
7050
  } finally {
7000
7051
  if (previousTransport === void 0) delete transportGlobal.__DSH_TRANSPORT__;
7001
7052
  else transportGlobal.__DSH_TRANSPORT__ = previousTransport;
@@ -7066,12 +7117,12 @@ var DshApiProxy = class {
7066
7117
  * Resolve the optional Schedule service lazily, on every read.
7067
7118
  *
7068
7119
  * The bridge is built from a `ctx.inject` on sessionController / connection
7069
- * / typertGateway, and `schedule` is deliberately NOT in that list: it only
7070
- * exists when the user enables the optional Automation tasks bundle. On a
7071
- * DSH 0.2.0 host those three services become ready well before
7072
- * ScheduleService finishes its own async init, so a value captured here in
7073
- * the constructor stayed `undefined` for the bridge's whole lifetime and
7074
- * welcome advertised `schedules=false` even with the bundle mounted.
7120
+ * / typertGateway, and `schedule` is deliberately NOT in that list: it is a
7121
+ * capability the host composition may or may not mount. On a DSH 0.2.0 host
7122
+ * those three services become ready well before ScheduleService finishes its
7123
+ * own async init, so a value captured in the constructor stayed `undefined`
7124
+ * for the bridge's whole lifetime and welcome advertised `schedules=false`
7125
+ * even with the service mounted.
7075
7126
  *
7076
7127
  * Once resolved the controller is kept: services are not torn down and
7077
7128
  * rebuilt underneath a live bridge, so re-resolving per call would be pure
@@ -7182,7 +7233,7 @@ var DshApiProxy = class {
7182
7233
  rename: async (request) => this.call(() => this.session.rename(request.payload)),
7183
7234
  cancel: async (request) => this.call(() => this.session.cancel(request.payload)),
7184
7235
  attachment: async (request) => this.call(() => this.session.attachment(request.payload)),
7185
- projections: async (request) => this.call(() => this.session.projections(request.payload))
7236
+ projections: async (request) => this.call(() => this.session.projections(request.payload, new AbortController().signal))
7186
7237
  };
7187
7238
  workspace = {
7188
7239
  list: async () => this.call(async () => {