agentroam 0.2.0-preview.3 → 0.2.0-preview.4

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 (87) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cloudflared/bundled-asset.test.js +1 -1
  3. package/dist/cloudflared/manifest.js +1 -1
  4. package/dist/tunnel/cloudflare-provider.js +17 -10
  5. package/dist/tunnel/cloudflare-provider.test.js +33 -0
  6. package/dist/tunnel/proxy-settings.js +141 -0
  7. package/dist/tunnel/proxy-settings.test.js +111 -0
  8. package/dist/tunnel/public-readiness.js +60 -36
  9. package/dist/tunnel/public-readiness.test.js +80 -0
  10. package/package.json +27 -9
  11. package/runtime/.next/BUILD_ID +1 -1
  12. package/runtime/.next/app-build-manifest.json +4 -4
  13. package/runtime/.next/app-path-routes-manifest.json +1 -1
  14. package/runtime/.next/build-manifest.json +7 -7
  15. package/runtime/.next/prerender-manifest.json +1 -1
  16. package/runtime/.next/react-loadable-manifest.json +1 -1
  17. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/runtime/.next/server/app/_not-found.html +1 -1
  19. package/runtime/.next/server/app/_not-found.rsc +1 -1
  20. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/model/route.js +1 -0
  23. package/runtime/.next/server/app/api/agent/model/route.js.nft.json +1 -0
  24. package/runtime/.next/server/app/api/agent/model.body +1 -0
  25. package/runtime/.next/server/app/api/agent/model.meta +1 -0
  26. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  27. package/runtime/.next/server/app/api/agent/steer/route.js +1 -0
  28. package/runtime/.next/server/app/api/agent/steer/route.js.nft.json +1 -0
  29. package/runtime/.next/server/app/api/agent/stream/route.js +3 -2
  30. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  31. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  32. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  33. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  34. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  35. package/runtime/.next/server/app/api/skills/route.js +1 -1
  36. package/runtime/.next/server/app/api/tools/route.js +1 -1
  37. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  38. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  39. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  40. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  41. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  42. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  43. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  44. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  45. package/runtime/.next/server/app/api/web-console/history/route.js.nft.json +1 -1
  46. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  47. package/runtime/.next/server/app/web/page.js +10 -10
  48. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  49. package/runtime/.next/server/app/web.html +1 -1
  50. package/runtime/.next/server/app/web.rsc +2 -2
  51. package/runtime/.next/server/app-paths-manifest.json +13 -11
  52. package/runtime/.next/server/chunks/322.js +28 -12
  53. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  54. package/runtime/.next/server/middleware-react-loadable-manifest.js +1 -1
  55. package/runtime/.next/server/pages/404.html +1 -1
  56. package/runtime/.next/server/pages/500.html +1 -1
  57. package/runtime/.next/server/server-reference-manifest.json +1 -1
  58. package/runtime/.next/static/chunks/982.9e87a5cc0e6b13cf.js +1 -0
  59. package/runtime/.next/static/chunks/app/web/page-02e0df331bb14489.js +1 -0
  60. package/runtime/.next/static/chunks/{main-a7dd8c98b48af038.js → main-30618c50527ce4e9.js} +1 -1
  61. package/runtime/.next/static/chunks/{webpack-d91bc49de770fd58.js → webpack-0c872a6ee48cbbdf.js} +1 -1
  62. package/runtime/node_modules/.package-lock.json +3 -3
  63. package/runtime/node_modules/@agent/core/dist/domain/context/ContextLoader.d.ts +2 -0
  64. package/runtime/node_modules/@agent/core/dist/domain/context/ContextLoader.d.ts.map +1 -1
  65. package/runtime/node_modules/@agent/core/dist/index.js +114 -12
  66. package/runtime/node_modules/@agent/core/dist/index.js.map +7 -6
  67. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteAnonymousWebStore.d.ts +13 -0
  68. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteAnonymousWebStore.d.ts.map +1 -0
  69. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteAnonymousWebStore.test.d.ts +2 -0
  70. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteAnonymousWebStore.test.d.ts.map +1 -0
  71. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteDatabase.d.ts.map +1 -1
  72. package/runtime/node_modules/@agent/core/dist/infrastructure/SQLiteSessionStore.d.ts.map +1 -1
  73. package/runtime/node_modules/@agent/core/dist/infrastructure/index.d.ts +1 -0
  74. package/runtime/node_modules/@agent/core/dist/infrastructure/index.d.ts.map +1 -1
  75. package/runtime/node_modules/node-abi/abi_registry.json +7 -0
  76. package/runtime/node_modules/node-abi/package.json +1 -1
  77. package/runtime/package-lock.json +3 -3
  78. package/runtime/webapp/dist/assets/App-lXIeMH5u.js +52 -0
  79. package/runtime/webapp/dist/assets/index-BAFMhDtY.js +42 -0
  80. package/runtime/webapp/dist/assets/index-Beg9M2xI.css +1 -0
  81. package/runtime/webapp/dist/index.html +17 -0
  82. package/runtime/webapp/dist/pcm-audio-worklet.js +126 -0
  83. package/runtime/ws-server.mjs +148 -18
  84. package/runtime/.next/static/chunks/982.bf2e6e7fe55cd5ca.js +0 -1
  85. package/runtime/.next/static/chunks/app/web/page-0ee508ac538f72d3.js +0 -1
  86. /package/runtime/.next/static/{OszWLAB2kMAnNfSwJzpyw → dclalTmecO-HMVQvSKG7g}/_buildManifest.js +0 -0
  87. /package/runtime/.next/static/{OszWLAB2kMAnNfSwJzpyw → dclalTmecO-HMVQvSKG7g}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- !function(){"use strict";var e,t,n,r,o,u,i,c,f,a,l,d,s={},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}},r=!0;try{s[e](n,n.exports,h),r=!1}finally{r&&delete p[e]}return n.exports}h.m=s,e=[],h.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(h.O).every(function(e){return h.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},h.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);h.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},h.d(o,u),o},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return"static/chunks/"+(658===e?"f3dd23f1":e)+"."+({118:"2a6035b13645ef2d",658:"b423f4328b6ce988",691:"a8277997da6aec2e",945:"029658916456ec41",982:"bf2e6e7fe55cd5ca"})[e]+".js"},h.miniCssF=function(e){return"static/css/ac3c182a4b5bc5f1.css"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",h.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,h.nc&&i.setAttribute("nonce",h.nc),i.setAttribute("data-webpack",o+n),i.src=h.tu(e)),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(s);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},h.tu=function(e){return h.tt().createScriptURL(e)},h.p="/_next/",i=function(e,t,n,r){var o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.onerror=o.onload=function(u){if(o.onerror=o.onload=null,"load"===u.type)n();else{var i=u&&("load"===u.type?"missing":u.type),c=u&&u.target&&u.target.href||t,f=Error("Loading CSS chunk "+e+" failed.\n("+c+")");f.code="CSS_CHUNK_LOAD_FAILED",f.type=i,f.request=c,o.parentNode.removeChild(o),r(f)}},o.href=t,document.head.appendChild(o),o},c=function(e,t){for(var n=document.getElementsByTagName("link"),r=0;r<n.length;r++){var o=n[r],u=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(u===e||u===t))return o}for(var i=document.getElementsByTagName("style"),r=0;r<i.length;r++){var o=i[r],u=o.getAttribute("data-href");if(u===e||u===t)return o}},f={272:0},h.f.miniCss=function(e,t){f[e]?t.push(f[e]):0!==f[e]&&({118:1})[e]&&t.push(f[e]=new Promise(function(t,n){var r=h.miniCssF(e),o=h.p+r;if(c(r,o))return t();i(e,o,t,n)}).then(function(){f[e]=0},function(t){throw delete f[e],t}))},a={272:0},h.f.j=function(e,t){var n=h.o(a,e)?a[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(118|272)$/.test(e))a[e]=0;else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),u=Error();h.l(o,function(t){if(h.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}}},h.O.j=function(e){return 0===a[e]},l=function(e,t){var n,r,o=t[0],u=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in u)h.o(u,n)&&(h.m[n]=u[n]);if(i)var f=i(h)}for(e&&e(t);c<o.length;c++)r=o[c],h.o(a,r)&&a[r]&&a[r][0](),a[r]=0;return h.O(f)},(d=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(l.bind(null,0)),d.push=l.bind(null,d.push.bind(d))}();
1
+ !function(){"use strict";var e,t,n,r,o,u,i,c,f,a,l,d,s={},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}},r=!0;try{s[e](n,n.exports,h),r=!1}finally{r&&delete p[e]}return n.exports}h.m=s,e=[],h.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(h.O).every(function(e){return h.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},h.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);h.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},h.d(o,u),o},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return"static/chunks/"+(658===e?"f3dd23f1":e)+"."+({118:"2a6035b13645ef2d",658:"b423f4328b6ce988",691:"a8277997da6aec2e",945:"029658916456ec41",982:"9e87a5cc0e6b13cf"})[e]+".js"},h.miniCssF=function(e){return"static/css/ac3c182a4b5bc5f1.css"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",h.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,h.nc&&i.setAttribute("nonce",h.nc),i.setAttribute("data-webpack",o+n),i.src=h.tu(e)),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(s);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},h.tu=function(e){return h.tt().createScriptURL(e)},h.p="/_next/",i=function(e,t,n,r){var o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.onerror=o.onload=function(u){if(o.onerror=o.onload=null,"load"===u.type)n();else{var i=u&&("load"===u.type?"missing":u.type),c=u&&u.target&&u.target.href||t,f=Error("Loading CSS chunk "+e+" failed.\n("+c+")");f.code="CSS_CHUNK_LOAD_FAILED",f.type=i,f.request=c,o.parentNode.removeChild(o),r(f)}},o.href=t,document.head.appendChild(o),o},c=function(e,t){for(var n=document.getElementsByTagName("link"),r=0;r<n.length;r++){var o=n[r],u=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(u===e||u===t))return o}for(var i=document.getElementsByTagName("style"),r=0;r<i.length;r++){var o=i[r],u=o.getAttribute("data-href");if(u===e||u===t)return o}},f={272:0},h.f.miniCss=function(e,t){f[e]?t.push(f[e]):0!==f[e]&&({118:1})[e]&&t.push(f[e]=new Promise(function(t,n){var r=h.miniCssF(e),o=h.p+r;if(c(r,o))return t();i(e,o,t,n)}).then(function(){f[e]=0},function(t){throw delete f[e],t}))},a={272:0},h.f.j=function(e,t){var n=h.o(a,e)?a[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(118|272)$/.test(e))a[e]=0;else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),u=Error();h.l(o,function(t){if(h.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}}},h.O.j=function(e){return 0===a[e]},l=function(e,t){var n,r,o=t[0],u=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in u)h.o(u,n)&&(h.m[n]=u[n]);if(i)var f=i(h)}for(e&&e(t);c<o.length;c++)r=o[c],h.o(a,r)&&a[r]&&a[r][0](),a[r]=0;return h.O(f)},(d=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(l.bind(null,0)),d.push=l.bind(null,d.push.bind(d))}();
@@ -388,9 +388,9 @@
388
388
  }
389
389
  },
390
390
  "node_modules/node-abi": {
391
- "version": "3.95.0",
392
- "resolved": "http://nexus.17usoft.com/repository/npm-all/node-abi/-/node-abi-3.95.0.tgz",
393
- "integrity": "sha512-T9iGctuocf0qIWFFOTxPzjT5q0SILqaBYXt272tlBHvTKC5+3JnkMirLxNJNkXHtFyBjU2Jx+NL4Zipr0B/c6Q==",
391
+ "version": "3.96.0",
392
+ "resolved": "http://nexus.17usoft.com/repository/npm-all/node-abi/-/node-abi-3.96.0.tgz",
393
+ "integrity": "sha512-rebQ/lz7i0EkoLzUVSrKRzA69zMkwLp95kKMWoMDkkM00Suxz0D7zEQPwRml5fQum24mj7bPvmlgLAmu2JCiYg==",
394
394
  "license": "MIT",
395
395
  "dependencies": {
396
396
  "semver": "^7.3.5"
@@ -1,5 +1,7 @@
1
1
  import type { IContextLoader, ProjectFile } from './entities.js';
2
2
  export declare class ContextLoader implements IContextLoader {
3
+ private readonly homeDirectory;
4
+ constructor(homeDirectory?: string);
3
5
  loadProjectContext(rootDir: string): Promise<ProjectFile[]>;
4
6
  loadFile(filePath: string): Promise<ProjectFile>;
5
7
  private loadRecursiveFile;
@@ -1 +1 @@
1
- {"version":3,"file":"ContextLoader.d.ts","sourceRoot":"","sources":["../../../src/domain/context/ContextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiBjE,qBAAa,aAAc,YAAW,cAAc;IAC5C,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAuC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YAaxC,iBAAiB;IAoCzB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAyB5D"}
1
+ {"version":3,"file":"ContextLoader.d.ts","sourceRoot":"","sources":["../../../src/domain/context/ContextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA8BjE,qBAAa,aAAc,YAAW,cAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,SAAY;IAEhD,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAuC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YAaxC,iBAAiB;IAoCzB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAsC5D"}
@@ -7507,6 +7507,7 @@ ${prompt}`);
7507
7507
 
7508
7508
  // src/domain/context/ContextLoader.ts
7509
7509
  import { constants } from "node:fs";
7510
+ import { homedir as homedir2 } from "node:os";
7510
7511
  import { open, readFile as readFile6, readdir as readdir4, realpath, stat as stat4 } from "node:fs/promises";
7511
7512
  import { join as join6, basename as basename2, isAbsolute, relative as relative3, resolve as resolve8, sep } from "node:path";
7512
7513
  var ROOT_PROJECT_FILES = [
@@ -7519,9 +7520,25 @@ var ROOT_PROJECT_FILES = [
7519
7520
  ];
7520
7521
  var CUSTOMER_AGENT_FILES = ROOT_PROJECT_FILES.map((file) => join6(".customer-agent", file));
7521
7522
  var INSTRUCTION_FILES = new Set(["AGENTS.md", "CLAUDE.md"]);
7522
- var EXCLUDED_DIRECTORIES = new Set(["node_modules", ".git", "dist"]);
7523
+ var EXCLUDED_DIRECTORIES = new Set([
7524
+ "node_modules",
7525
+ ".git",
7526
+ "dist",
7527
+ "build",
7528
+ "out",
7529
+ "coverage",
7530
+ ".cache",
7531
+ ".next",
7532
+ ".next-dev",
7533
+ ".output",
7534
+ ".turbo"
7535
+ ]);
7523
7536
 
7524
7537
  class ContextLoader {
7538
+ homeDirectory;
7539
+ constructor(homeDirectory = homedir2()) {
7540
+ this.homeDirectory = homeDirectory;
7541
+ }
7525
7542
  async loadProjectContext(rootDir) {
7526
7543
  const files = [];
7527
7544
  const loadedPaths = new Set;
@@ -7593,12 +7610,20 @@ class ContextLoader {
7593
7610
  }
7594
7611
  async findClaudeMdFiles(rootDir) {
7595
7612
  const results = [];
7613
+ try {
7614
+ const [resolvedRoot, resolvedHome] = await Promise.all([
7615
+ realpath(rootDir),
7616
+ realpath(this.homeDirectory)
7617
+ ]);
7618
+ if (resolvedRoot === resolvedHome)
7619
+ return results;
7620
+ } catch {}
7596
7621
  const scan = async (dir) => {
7597
7622
  try {
7598
7623
  const entries = await readdir4(dir, { withFileTypes: true });
7599
7624
  entries.sort((left, right) => left.name.localeCompare(right.name));
7600
7625
  for (const entry of entries) {
7601
- if (EXCLUDED_DIRECTORIES.has(entry.name))
7626
+ if (EXCLUDED_DIRECTORIES.has(entry.name) || basename2(dir) === ".claude" && entry.name === "worktrees")
7602
7627
  continue;
7603
7628
  const fullPath = join6(dir, entry.name);
7604
7629
  if (entry.isDirectory()) {
@@ -9777,7 +9802,22 @@ class SQLiteRemoteToolStore {
9777
9802
  // src/infrastructure/SQLiteDatabase.ts
9778
9803
  import Database from "better-sqlite3";
9779
9804
  import { join as join10 } from "node:path";
9780
- import { mkdirSync as mkdirSync3 } from "node:fs";
9805
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync as readdirSync3 } from "node:fs";
9806
+ import { homedir as homedir3 } from "node:os";
9807
+ function resolveNativeBinding() {
9808
+ const kind = process.versions.electron ? `electron-${process.versions.electron}` : `node-${process.versions.modules}`;
9809
+ try {
9810
+ const root = process.platform === "darwin" ? join10(homedir3(), "Library", "Caches", "team-agent", "native") : join10(homedir3(), ".cache", "team-agent", "native");
9811
+ for (const entry of readdirSync3(join10(root, kind))) {
9812
+ if (!entry.startsWith("better-sqlite3-"))
9813
+ continue;
9814
+ const candidate = join10(root, kind, entry, "better_sqlite3.node");
9815
+ if (existsSync3(candidate))
9816
+ return candidate;
9817
+ }
9818
+ } catch {}
9819
+ return;
9820
+ }
9781
9821
 
9782
9822
  class SQLiteDatabase {
9783
9823
  db;
@@ -9787,7 +9827,8 @@ class SQLiteDatabase {
9787
9827
  mkdirSync3(dataDir, { recursive: true });
9788
9828
  } catch {}
9789
9829
  const dbPath = join10(dataDir, "agent.db");
9790
- this.db = new Database(dbPath);
9830
+ const binding = resolveNativeBinding();
9831
+ this.db = new Database(dbPath, binding ? { nativeBinding: binding } : undefined);
9791
9832
  this.db.pragma("journal_mode = WAL");
9792
9833
  this.db.pragma("foreign_keys = ON");
9793
9834
  this.migrate();
@@ -9970,6 +10011,12 @@ class SQLiteDatabase {
9970
10011
  revoked_at TEXT
9971
10012
  );
9972
10013
 
10014
+ CREATE TABLE IF NOT EXISTS anonymous_ws_nonces (
10015
+ nonce_hash BLOB PRIMARY KEY,
10016
+ user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
10017
+ expires_at INTEGER NOT NULL
10018
+ );
10019
+
9973
10020
  CREATE TABLE IF NOT EXISTS login_attempts (
9974
10021
  id INTEGER PRIMARY KEY AUTOINCREMENT,
9975
10022
  username_normalized TEXT NOT NULL,
@@ -10032,6 +10079,7 @@ class SQLiteDatabase {
10032
10079
  CREATE INDEX IF NOT EXISTS idx_remote_tools_project ON remote_tools(project_id);
10033
10080
  CREATE INDEX IF NOT EXISTS idx_remote_jobs_project ON remote_tool_jobs(project_id);
10034
10081
  CREATE INDEX IF NOT EXISTS idx_auth_sessions_user ON auth_sessions(user_id);
10082
+ CREATE INDEX IF NOT EXISTS idx_anonymous_ws_nonces_expiry ON anonymous_ws_nonces(expires_at);
10035
10083
  CREATE INDEX IF NOT EXISTS idx_login_attempts_lookup
10036
10084
  ON login_attempts(username_normalized, ip, attempted_at);
10037
10085
  CREATE INDEX IF NOT EXISTS idx_terminal_tabs_user_order ON terminal_tabs(user_id, sort_order);
@@ -10346,13 +10394,18 @@ class SQLiteSessionStore {
10346
10394
  parentSessionId: row.parent_id ?? undefined,
10347
10395
  title: row.title,
10348
10396
  status: row.status,
10349
- messages: msgRows.map((m) => ({
10350
- role: m.role,
10351
- content: m.content,
10352
- toolCalls: JSON.parse(m.tool_calls),
10353
- toolCallId: m.tool_call_id,
10354
- name: m.name
10355
- })),
10397
+ messages: msgRows.map((m) => {
10398
+ const toolCalls = JSON.parse(m.tool_calls);
10399
+ const toolCallId = m.tool_call_id ?? undefined;
10400
+ const name = m.name ?? undefined;
10401
+ return {
10402
+ role: m.role,
10403
+ content: m.content,
10404
+ ...toolCalls?.length ? { toolCalls } : {},
10405
+ ...toolCallId !== undefined ? { toolCallId } : {},
10406
+ ...name !== undefined ? { name } : {}
10407
+ };
10408
+ }),
10356
10409
  events: evtRows.map((e) => JSON.parse(e.data)),
10357
10410
  created: row.created,
10358
10411
  updated: row.updated,
@@ -10885,6 +10938,54 @@ class SQLiteAuthStore {
10885
10938
  return { id: row.id, userId: row.user_id, tokenHash: row.token_hash, csrfHash: row.csrf_hash, wsNonceHash: row.ws_nonce_hash, wsNonceExpiresAt: row.ws_nonce_expires_at, deviceId: row.device_id, deviceName: row.device_name ?? "", userAgent: row.user_agent ?? "", createdAt: row.created_at, lastSeenAt: row.last_seen_at, expiresAt: row.expires_at, revokedAt: row.revoked_at };
10886
10939
  }
10887
10940
  }
10941
+ // src/infrastructure/SQLiteAnonymousWebStore.ts
10942
+ import { createHash as createHash2, randomBytes as randomBytes3 } from "node:crypto";
10943
+ var LOCAL_USER_ID = "local-web";
10944
+ var LOCAL_USERNAME = "local";
10945
+ function hashNonce(nonce) {
10946
+ return createHash2("sha256").update(nonce).digest();
10947
+ }
10948
+
10949
+ class SQLiteAnonymousWebStore {
10950
+ db;
10951
+ constructor(baseDir) {
10952
+ this.db = getDatabase(baseDir).db;
10953
+ }
10954
+ getOrCreatePrincipal() {
10955
+ const existing = this.findPrincipal();
10956
+ if (existing)
10957
+ return { userId: existing.id, username: LOCAL_USERNAME };
10958
+ const now2 = new Date().toISOString();
10959
+ this.db.prepare(`
10960
+ INSERT OR IGNORE INTO users (
10961
+ id, username_normalized, username_display, password_hash, password_salt,
10962
+ password_version, created_at, password_changed_at
10963
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
10964
+ `).run(LOCAL_USER_ID, LOCAL_USERNAME, LOCAL_USERNAME, randomBytes3(32), randomBytes3(16), 1, now2, now2);
10965
+ const created = this.findPrincipal();
10966
+ if (!created)
10967
+ throw new Error("failed to initialize anonymous web principal");
10968
+ return { userId: created.id, username: LOCAL_USERNAME };
10969
+ }
10970
+ issueWsNonce(nonce, userId, expiresAt, now2 = Date.now()) {
10971
+ const nonceHash = hashNonce(nonce);
10972
+ this.db.transaction(() => {
10973
+ this.db.prepare("DELETE FROM anonymous_ws_nonces WHERE expires_at <= ?").run(now2);
10974
+ this.db.prepare("INSERT INTO anonymous_ws_nonces (nonce_hash, user_id, expires_at) VALUES (?, ?, ?)").run(nonceHash, userId, expiresAt);
10975
+ })();
10976
+ }
10977
+ consumeWsNonce(nonce, now2 = Date.now()) {
10978
+ const row = this.db.prepare(`
10979
+ DELETE FROM anonymous_ws_nonces
10980
+ WHERE nonce_hash = ? AND expires_at > ?
10981
+ RETURNING user_id
10982
+ `).get(hashNonce(nonce), now2);
10983
+ return row?.user_id ?? null;
10984
+ }
10985
+ findPrincipal() {
10986
+ return this.db.prepare("SELECT id, username_display FROM users ORDER BY created_at, id LIMIT 1").get();
10987
+ }
10988
+ }
10888
10989
  // src/infrastructure/SQLiteWebConsoleStore.ts
10889
10990
  class SQLiteWebConsoleStore {
10890
10991
  db;
@@ -10999,6 +11100,7 @@ export {
10999
11100
  SQLiteLSPServerStore,
11000
11101
  SQLiteDatabase,
11001
11102
  SQLiteAuthStore,
11103
+ SQLiteAnonymousWebStore,
11002
11104
  SQLiteAgentStore,
11003
11105
  RemoteProjectActionTool,
11004
11106
  ReadFileTool,
@@ -11037,4 +11139,4 @@ export {
11037
11139
  AgentBuilder
11038
11140
  };
11039
11141
 
11040
- //# debugId=05A3BC3FF39651A264756E2164756E21
11142
+ //# debugId=C6BE36C988D639E764756E2164756E21