@goondocks/myco 0.18.1 → 0.19.1
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/README.md +17 -130
- package/dist/{agent-run-I4O2K2CK.js → agent-run-BV3ATBWB.js} +6 -6
- package/dist/{agent-tasks-UOW5BQIB.js → agent-tasks-I5SMLWVL.js} +6 -6
- package/dist/{chunk-TCSVDQF5.js → chunk-3J6TUJSV.js} +58 -58
- package/dist/chunk-3J6TUJSV.js.map +1 -0
- package/dist/{chunk-W7WENJ6F.js → chunk-46AQ7D23.js} +2 -2
- package/dist/{chunk-2V7HR7HB.js → chunk-4NIMDUYW.js} +5 -7
- package/dist/{chunk-2V7HR7HB.js.map → chunk-4NIMDUYW.js.map} +1 -1
- package/dist/{chunk-CURS2TNP.js → chunk-6DDRJQ4X.js} +2 -2
- package/dist/{chunk-D7TYRPRM.js → chunk-6LQIMRTC.js} +145 -145
- package/dist/chunk-6LQIMRTC.js.map +1 -0
- package/dist/{chunk-75AZFBFW.js → chunk-6ZDJXSEO.js} +3 -3
- package/dist/{chunk-TLK46KKD.js → chunk-AOCBCPAP.js} +5 -5
- package/dist/chunk-AOCBCPAP.js.map +1 -0
- package/dist/{chunk-O3TRN3RC.js → chunk-AULBWINA.js} +2 -2
- package/dist/chunk-CDM6ZLMZ.js +598 -0
- package/dist/chunk-CDM6ZLMZ.js.map +1 -0
- package/dist/{chunk-TOER6RNC.js → chunk-GVBVHYOT.js} +2 -2
- package/dist/{chunk-RIDSOQDR.js → chunk-HQLPB346.js} +2 -2
- package/dist/{chunk-CKJAWZQE.js → chunk-I54KLC6H.js} +13 -3
- package/dist/chunk-I54KLC6H.js.map +1 -0
- package/dist/{chunk-XWOQL4XN.js → chunk-NU74DHV3.js} +3 -3
- package/dist/{chunk-E4VLWIJC.js → chunk-ODXLRR4U.js} +1 -1
- package/dist/{chunk-RAV5YMRU.js → chunk-OR4XUYBJ.js} +4 -4
- package/dist/{chunk-CML4MCYF.js → chunk-PMT2LSTQ.js} +2 -2
- package/dist/{chunk-IB76KGBY.js → chunk-POEPHBQK.js} +1 -1
- package/dist/{chunk-TZAXQKO6.js → chunk-PZEAO35P.js} +2 -2
- package/dist/{chunk-GDY63YAW.js → chunk-U6PF3YII.js} +79 -79
- package/dist/chunk-U6PF3YII.js.map +1 -0
- package/dist/{chunk-C3EGL5JX.js → chunk-ULH667GT.js} +8 -8
- package/dist/{chunk-DPSLJ242.js → chunk-UVKQ62II.js} +3 -3
- package/dist/{chunk-N75GMQGA.js → chunk-VNL7KN4V.js} +3 -3
- package/dist/{chunk-U3J2DDSR.js → chunk-VQF5E4ZX.js} +2 -2
- package/dist/{chunk-LSP5HYOO.js → chunk-WGIQOJKJ.js} +4 -4
- package/dist/{chunk-YZPI2Y3E.js → chunk-WKNAKQKA.js} +3 -3
- package/dist/{chunk-NI23QCHB.js → chunk-YDU3AHSW.js} +5 -5
- package/dist/{cli-D3TJYJ2U.js → cli-2BW2PZMP.js} +39 -39
- package/dist/{client-4LLEXLVK.js → client-HMGTCKRW.js} +4 -4
- package/dist/{config-DA4IUVFL.js → config-LVXDVUYY.js} +6 -6
- package/dist/{detect-SZ2KDUF4.js → detect-BEOIHGBC.js} +5 -5
- package/dist/{detect-providers-PSVKXTWE.js → detect-providers-CDG6BKHU.js} +4 -4
- package/dist/{doctor-KCTXPX5D.js → doctor-AK3W5FMN.js} +11 -11
- package/dist/{executor-UYIZC3L5.js → executor-YLC7DHBY.js} +17 -17
- package/dist/{init-QFNBKKDC.js → init-4FV7ODOK.js} +15 -15
- package/dist/{llm-SMA5ZEAW.js → llm-INLSGEXY.js} +4 -4
- package/dist/{loader-Q3P3R4UP.js → loader-2ULW2FZS.js} +6 -6
- package/dist/{loader-SKKUMT5C.js → loader-HEGKUTGI.js} +6 -6
- package/dist/{main-5THODR77.js → main-IV64U72E.js} +348 -86
- package/dist/main-IV64U72E.js.map +1 -0
- package/dist/{open-7737CSPN.js → open-YSB36HP7.js} +6 -6
- package/dist/{post-compact-2TJ5FPZH.js → post-compact-5OB4LRLA.js} +10 -10
- package/dist/{post-tool-use-FRTSICC3.js → post-tool-use-2UOTDXXS.js} +9 -9
- package/dist/{post-tool-use-failure-KYO2NCNB.js → post-tool-use-failure-ZJQGHBMW.js} +10 -10
- package/dist/{pre-compact-J6GCJEJR.js → pre-compact-WD3FYUZ4.js} +10 -10
- package/dist/{provider-check-AE3L5Z6R.js → provider-check-V3NSOLZQ.js} +4 -4
- package/dist/{registry-O2NZLO3V.js → registry-XGRKLHEK.js} +7 -7
- package/dist/{remove-3WZZC7AX.js → remove-L6T4LMFP.js} +11 -11
- package/dist/{resolution-events-XWYLLDRK.js → resolution-events-PZFKMZHM.js} +4 -4
- package/dist/{restart-HUHEFOXU.js → restart-4UGLWER2.js} +7 -7
- package/dist/{search-ZGN3LDXG.js → search-MJGMQZ5N.js} +7 -7
- package/dist/{server-PTXLVVEE.js → server-MVBNGXLQ.js} +258 -173
- package/dist/server-MVBNGXLQ.js.map +1 -0
- package/dist/{session-7VV3IQMO.js → session-GLKHGGPJ.js} +8 -8
- package/dist/{session-end-SMU55UCM.js → session-end-ISPUQH3X.js} +9 -9
- package/dist/{session-start-NIMWEOIZ.js → session-start-VF26JMWW.js} +14 -14
- package/dist/{setup-llm-7S3VPAPN.js → setup-llm-7RCROQLP.js} +10 -10
- package/dist/src/cli.js +1 -1
- package/dist/src/daemon/main.js +1 -1
- package/dist/src/hooks/post-tool-use.js +1 -1
- package/dist/src/hooks/session-end.js +1 -1
- package/dist/src/hooks/session-start.js +1 -1
- package/dist/src/hooks/stop.js +1 -1
- package/dist/src/hooks/user-prompt-submit.js +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/{stats-GEOQ2DFF.js → stats-N7FYQSAY.js} +11 -11
- package/dist/{stop-7AKYBJJ2.js → stop-LVRFMSGO.js} +9 -9
- package/dist/{stop-failure-NLE2EURG.js → stop-failure-AXU5LOBN.js} +10 -10
- package/dist/{subagent-start-LBNZF2TG.js → subagent-start-KDJIQXQC.js} +10 -10
- package/dist/{subagent-stop-B2Z5GYAB.js → subagent-stop-2T2H2TYE.js} +10 -10
- package/dist/{task-completed-PO5TETJ7.js → task-completed-XHQ3XMYJ.js} +10 -10
- package/dist/team-GM2VZOVM.js +22 -0
- package/dist/ui/assets/{index-CiI1fwas.js → index-JtMb9fMt.js} +48 -48
- package/dist/ui/index.html +1 -1
- package/dist/{update-WBWB5URU.js → update-R6VHTRQA.js} +11 -11
- package/dist/{user-prompt-submit-IZJC3NV7.js → user-prompt-submit-EK2MDBLQ.js} +9 -9
- package/dist/{verify-FNSP62I3.js → verify-NK46D4II.js} +8 -8
- package/dist/{version-QEVU66NT.js → version-LTTJPC4F.js} +2 -2
- package/dist/version-LTTJPC4F.js.map +1 -0
- package/package.json +19 -2
- package/CONTRIBUTING.md +0 -132
- package/dist/chunk-CKJAWZQE.js.map +0 -1
- package/dist/chunk-D7TYRPRM.js.map +0 -1
- package/dist/chunk-GDY63YAW.js.map +0 -1
- package/dist/chunk-RJMXDUMA.js +0 -40
- package/dist/chunk-RJMXDUMA.js.map +0 -1
- package/dist/chunk-TCSVDQF5.js.map +0 -1
- package/dist/chunk-TLK46KKD.js.map +0 -1
- package/dist/main-5THODR77.js.map +0 -1
- package/dist/server-PTXLVVEE.js.map +0 -1
- package/dist/src/worker/package-lock.json +0 -4338
- package/dist/src/worker/package.json +0 -22
- package/dist/src/worker/src/auth.ts +0 -31
- package/dist/src/worker/src/index.ts +0 -476
- package/dist/src/worker/src/mcp/auth.ts +0 -65
- package/dist/src/worker/src/mcp/server.ts +0 -53
- package/dist/src/worker/src/mcp/tools/context.ts +0 -13
- package/dist/src/worker/src/mcp/tools/get.ts +0 -15
- package/dist/src/worker/src/mcp/tools/graph.ts +0 -35
- package/dist/src/worker/src/mcp/tools/search.ts +0 -32
- package/dist/src/worker/src/mcp/tools/sessions.ts +0 -24
- package/dist/src/worker/src/mcp/tools/skills.ts +0 -16
- package/dist/src/worker/src/mcp/tools/team.ts +0 -9
- package/dist/src/worker/src/schema.ts +0 -326
- package/dist/src/worker/src/search-helpers.ts +0 -70
- package/dist/src/worker/tsconfig.json +0 -16
- package/dist/src/worker/wrangler.toml +0 -30
- package/dist/team-DPNP2RN7.js +0 -368
- package/dist/team-DPNP2RN7.js.map +0 -1
- /package/dist/{agent-run-I4O2K2CK.js.map → agent-run-BV3ATBWB.js.map} +0 -0
- /package/dist/{agent-tasks-UOW5BQIB.js.map → agent-tasks-I5SMLWVL.js.map} +0 -0
- /package/dist/{chunk-W7WENJ6F.js.map → chunk-46AQ7D23.js.map} +0 -0
- /package/dist/{chunk-CURS2TNP.js.map → chunk-6DDRJQ4X.js.map} +0 -0
- /package/dist/{chunk-75AZFBFW.js.map → chunk-6ZDJXSEO.js.map} +0 -0
- /package/dist/{chunk-O3TRN3RC.js.map → chunk-AULBWINA.js.map} +0 -0
- /package/dist/{chunk-TOER6RNC.js.map → chunk-GVBVHYOT.js.map} +0 -0
- /package/dist/{chunk-RIDSOQDR.js.map → chunk-HQLPB346.js.map} +0 -0
- /package/dist/{chunk-XWOQL4XN.js.map → chunk-NU74DHV3.js.map} +0 -0
- /package/dist/{chunk-E4VLWIJC.js.map → chunk-ODXLRR4U.js.map} +0 -0
- /package/dist/{chunk-RAV5YMRU.js.map → chunk-OR4XUYBJ.js.map} +0 -0
- /package/dist/{chunk-CML4MCYF.js.map → chunk-PMT2LSTQ.js.map} +0 -0
- /package/dist/{chunk-IB76KGBY.js.map → chunk-POEPHBQK.js.map} +0 -0
- /package/dist/{chunk-TZAXQKO6.js.map → chunk-PZEAO35P.js.map} +0 -0
- /package/dist/{chunk-C3EGL5JX.js.map → chunk-ULH667GT.js.map} +0 -0
- /package/dist/{chunk-DPSLJ242.js.map → chunk-UVKQ62II.js.map} +0 -0
- /package/dist/{chunk-N75GMQGA.js.map → chunk-VNL7KN4V.js.map} +0 -0
- /package/dist/{chunk-U3J2DDSR.js.map → chunk-VQF5E4ZX.js.map} +0 -0
- /package/dist/{chunk-LSP5HYOO.js.map → chunk-WGIQOJKJ.js.map} +0 -0
- /package/dist/{chunk-YZPI2Y3E.js.map → chunk-WKNAKQKA.js.map} +0 -0
- /package/dist/{chunk-NI23QCHB.js.map → chunk-YDU3AHSW.js.map} +0 -0
- /package/dist/{cli-D3TJYJ2U.js.map → cli-2BW2PZMP.js.map} +0 -0
- /package/dist/{client-4LLEXLVK.js.map → client-HMGTCKRW.js.map} +0 -0
- /package/dist/{config-DA4IUVFL.js.map → config-LVXDVUYY.js.map} +0 -0
- /package/dist/{detect-SZ2KDUF4.js.map → detect-BEOIHGBC.js.map} +0 -0
- /package/dist/{detect-providers-PSVKXTWE.js.map → detect-providers-CDG6BKHU.js.map} +0 -0
- /package/dist/{doctor-KCTXPX5D.js.map → doctor-AK3W5FMN.js.map} +0 -0
- /package/dist/{executor-UYIZC3L5.js.map → executor-YLC7DHBY.js.map} +0 -0
- /package/dist/{init-QFNBKKDC.js.map → init-4FV7ODOK.js.map} +0 -0
- /package/dist/{llm-SMA5ZEAW.js.map → llm-INLSGEXY.js.map} +0 -0
- /package/dist/{loader-Q3P3R4UP.js.map → loader-2ULW2FZS.js.map} +0 -0
- /package/dist/{loader-SKKUMT5C.js.map → loader-HEGKUTGI.js.map} +0 -0
- /package/dist/{open-7737CSPN.js.map → open-YSB36HP7.js.map} +0 -0
- /package/dist/{post-compact-2TJ5FPZH.js.map → post-compact-5OB4LRLA.js.map} +0 -0
- /package/dist/{post-tool-use-FRTSICC3.js.map → post-tool-use-2UOTDXXS.js.map} +0 -0
- /package/dist/{post-tool-use-failure-KYO2NCNB.js.map → post-tool-use-failure-ZJQGHBMW.js.map} +0 -0
- /package/dist/{pre-compact-J6GCJEJR.js.map → pre-compact-WD3FYUZ4.js.map} +0 -0
- /package/dist/{provider-check-AE3L5Z6R.js.map → provider-check-V3NSOLZQ.js.map} +0 -0
- /package/dist/{registry-O2NZLO3V.js.map → registry-XGRKLHEK.js.map} +0 -0
- /package/dist/{remove-3WZZC7AX.js.map → remove-L6T4LMFP.js.map} +0 -0
- /package/dist/{resolution-events-XWYLLDRK.js.map → resolution-events-PZFKMZHM.js.map} +0 -0
- /package/dist/{restart-HUHEFOXU.js.map → restart-4UGLWER2.js.map} +0 -0
- /package/dist/{search-ZGN3LDXG.js.map → search-MJGMQZ5N.js.map} +0 -0
- /package/dist/{session-7VV3IQMO.js.map → session-GLKHGGPJ.js.map} +0 -0
- /package/dist/{session-end-SMU55UCM.js.map → session-end-ISPUQH3X.js.map} +0 -0
- /package/dist/{session-start-NIMWEOIZ.js.map → session-start-VF26JMWW.js.map} +0 -0
- /package/dist/{setup-llm-7S3VPAPN.js.map → setup-llm-7RCROQLP.js.map} +0 -0
- /package/dist/{stats-GEOQ2DFF.js.map → stats-N7FYQSAY.js.map} +0 -0
- /package/dist/{stop-7AKYBJJ2.js.map → stop-LVRFMSGO.js.map} +0 -0
- /package/dist/{stop-failure-NLE2EURG.js.map → stop-failure-AXU5LOBN.js.map} +0 -0
- /package/dist/{subagent-start-LBNZF2TG.js.map → subagent-start-KDJIQXQC.js.map} +0 -0
- /package/dist/{subagent-stop-B2Z5GYAB.js.map → subagent-stop-2T2H2TYE.js.map} +0 -0
- /package/dist/{task-completed-PO5TETJ7.js.map → task-completed-XHQ3XMYJ.js.map} +0 -0
- /package/dist/{version-QEVU66NT.js.map → team-GM2VZOVM.js.map} +0 -0
- /package/dist/{update-WBWB5URU.js.map → update-R6VHTRQA.js.map} +0 -0
- /package/dist/{user-prompt-submit-IZJC3NV7.js.map → user-prompt-submit-EK2MDBLQ.js.map} +0 -0
- /package/dist/{verify-FNSP62I3.js.map → verify-NK46D4II.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../myco-team/src/cli.ts","../src/config/secrets.ts","../../myco-deploy/src/cloudflare.ts","../../myco-deploy/src/local-config.ts"],"sourcesContent":["/**\n * CLI team commands — provision and manage Cloudflare team sync infrastructure.\n *\n * `myco team init` — Provision D1 database, Vectorize index, deploy worker.\n * `myco team upgrade` — Redeploy worker with updated source.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { CONFIG_FILENAME, loadConfig, updateTeamConfig } from '@myco/config/loader.js';\nimport { writeSecret, readSecrets } from '@myco/config/secrets.js';\nimport { WRANGLER_COMMAND_TIMEOUT_MS, TEAM_API_KEY_SECRET, TEAM_MCP_TOKEN_SECRET } from '@myco/constants.js';\nimport { SCHEMA_VERSION } from '@myco/db/schema.js';\nimport {\n extractJsonArray,\n installDeploymentDeps,\n maskSecret,\n parseD1Id,\n parseKvNamespaceId,\n parseWorkerUrl,\n readJsonConfig,\n resolveHomeConfigPath,\n resolveVaultConfigPath,\n runWrangler,\n stageDeploymentDir,\n writeJsonConfig,\n} from '@myco-deploy/index.js';\n\ndeclare const __MYCO_TEAM_VERSION__: string;\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\n/** Number of random bytes for API key generation. */\nconst API_KEY_BYTES = 32;\n\n/** Vectorize index dimensions (must match the embedding model). */\nconst VECTORIZE_DIMENSIONS = '1024';\n\n/** Vectorize distance metric. */\nconst VECTORIZE_METRIC = 'cosine';\n\n/** Prefix for team resource names. */\nconst TEAM_RESOURCE_PREFIX = 'myco-team';\n\n/** Length of the project hash suffix for unique resource naming. */\nconst PROJECT_HASH_LENGTH = 8;\n\n\n/** Source directory for worker files (relative to package root). */\nconst WORKER_SOURCE_DIR = 'worker';\n\n/** Team sync state directory within the vault. */\nconst TEAM_STATE_DIR = 'team';\nconst TEAM_DEPLOY_DIR = 'worker';\nconst TEAM_CONFIG_FILE = 'config.json';\nconst LEGACY_TEAM_CONFIG_DIR = '.myco-team';\nconst LEGACY_TEAM_DEPLOY_DIR = '.team-worker';\nconst TEAM_CONFIG_VERSION = 1;\nconst TEAM_MCP_ROTATION_RETRY_ATTEMPTS = 10;\nconst TEAM_MCP_ROTATION_RETRY_DELAY_MS = 1500;\n\n/** Regex to match wrangler.toml name field. */\nconst TOML_NAME_REGEX = /^name\\s*=\\s*\"[^\"]*\"/m;\n\n/** Regex to match wrangler.toml D1 placeholder. */\nconst TOML_D1_PLACEHOLDER_REGEX = /<YOUR_D1_DATABASE_ID>/g;\n\n/** Regex to match wrangler.toml database_name field. */\nconst TOML_DB_NAME_REGEX = /database_name\\s*=\\s*\"[^\"]*\"/g;\n\n/** Regex to match wrangler.toml index_name field. */\nconst TOML_INDEX_NAME_REGEX = /index_name\\s*=\\s*\"[^\"]*\"/g;\n\n/** Regex to match wrangler.toml team package version placeholder. */\nconst TOML_TEAM_PACKAGE_VERSION_REGEX = /MYCO_TEAM_PACKAGE_VERSION\\s*=\\s*\"[^\"]*\"/g;\n\n/** Regex to match wrangler.toml Myco schema version placeholder. */\nconst TOML_MYCO_SCHEMA_VERSION_REGEX = /MYCO_SCHEMA_VERSION\\s*=\\s*\"[^\"]*\"/g;\n\n/** Regex to match database_id in existing wrangler.toml. */\nconst TOML_DB_ID_REGEX = /database_id\\s*=\\s*\"([^\"]+)\"/;\n\n/** Regex to match wrangler.toml KV namespace placeholder. */\nconst TOML_KV_PLACEHOLDER_REGEX = /<YOUR_KV_NAMESPACE_ID>/g;\n\n/** Regex to extract the KV namespace ID from an existing wrangler.toml. */\nconst TOML_KV_ID_REGEX = /\\[\\[kv_namespaces\\]\\][\\s\\S]*?id\\s*=\\s*\"([0-9a-f]+)\"/;\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Generate a project hash from vault dir for unique resource naming. */\nfunction projectHash(vaultDir: string): string {\n const hash = crypto.createHash('sha256').update(vaultDir).digest('hex');\n return hash.slice(0, PROJECT_HASH_LENGTH);\n}\n\n/** Build the unique resource name for this project's team infrastructure. */\nfunction resourceName(vaultDir: string): string {\n return `${TEAM_RESOURCE_PREFIX}-${projectHash(vaultDir)}`;\n}\n\nfunction resolvePackageRoot(): string {\n const override = process.env.MYCO_TEAM_PACKAGE_ROOT?.trim();\n if (override) return override;\n return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n}\n\nexport function getTeamPackageVersion(): string {\n if (typeof __MYCO_TEAM_VERSION__ !== 'undefined') {\n return __MYCO_TEAM_VERSION__;\n }\n\n const packageRoot = resolvePackageRoot();\n const candidatePaths = [\n path.join(packageRoot, 'package.json'),\n path.join(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'), 'package.json'),\n ];\n\n for (const candidatePath of candidatePaths) {\n if (!fs.existsSync(candidatePath)) continue;\n const packageJson = JSON.parse(fs.readFileSync(candidatePath, 'utf-8')) as { version?: string };\n if (packageJson.version) return packageJson.version;\n }\n\n return '0.1.0';\n}\n\nfunction getMycoSchemaVersion(): string {\n return String(SCHEMA_VERSION);\n}\n\nexport interface TeamLocalConfig {\n worker_name: string;\n worker_url: string;\n package_version: string;\n created_at: string;\n last_upgraded: string;\n config_version: number;\n}\n\ninterface LegacyTeamLocalConfig extends TeamLocalConfig {\n api_key?: string;\n mcp_token?: string | null;\n vault_dir?: string;\n}\n\nfunction resolveLocalConfigPath(vaultDir: string): string {\n return resolveVaultConfigPath(vaultDir, TEAM_STATE_DIR, TEAM_CONFIG_FILE);\n}\n\nfunction resolveLegacyLocalConfigPath(): string {\n return resolveHomeConfigPath(LEGACY_TEAM_CONFIG_DIR, TEAM_CONFIG_FILE);\n}\n\nfunction resolveDeployDir(vaultDir: string): string {\n return path.join(vaultDir, TEAM_STATE_DIR, TEAM_DEPLOY_DIR);\n}\n\nfunction resolveLegacyDeployDir(vaultDir: string): string {\n return path.join(vaultDir, LEGACY_TEAM_DEPLOY_DIR);\n}\n\nfunction writeLocalConfig(vaultDir: string, config: TeamLocalConfig): void {\n writeJsonConfig(resolveLocalConfigPath(vaultDir), config);\n}\n\nfunction migrateLegacyDeployDir(vaultDir: string): void {\n const legacyDeployDir = resolveLegacyDeployDir(vaultDir);\n const nextDeployDir = resolveDeployDir(vaultDir);\n if (!fs.existsSync(legacyDeployDir) || fs.existsSync(nextDeployDir)) return;\n\n fs.mkdirSync(path.dirname(nextDeployDir), { recursive: true });\n fs.renameSync(legacyDeployDir, nextDeployDir);\n}\n\nfunction readLocalConfig(vaultDir: string): TeamLocalConfig | null {\n const config = readJsonConfig<TeamLocalConfig>(resolveLocalConfigPath(vaultDir));\n if (config) {\n migrateLegacyDeployDir(vaultDir);\n return config;\n }\n\n const legacyConfig = readJsonConfig<LegacyTeamLocalConfig>(resolveLegacyLocalConfigPath());\n if (!legacyConfig) return null;\n if (legacyConfig.vault_dir && legacyConfig.vault_dir !== vaultDir) return null;\n\n const migrated: TeamLocalConfig = {\n worker_name: legacyConfig.worker_name,\n worker_url: legacyConfig.worker_url,\n package_version: legacyConfig.package_version,\n created_at: legacyConfig.created_at,\n last_upgraded: legacyConfig.last_upgraded,\n config_version: legacyConfig.config_version ?? TEAM_CONFIG_VERSION,\n };\n writeLocalConfig(vaultDir, migrated);\n if (legacyConfig.api_key) writeSecret(vaultDir, TEAM_API_KEY_SECRET, legacyConfig.api_key);\n if (legacyConfig.mcp_token) writeSecret(vaultDir, TEAM_MCP_TOKEN_SECRET, legacyConfig.mcp_token);\n migrateLegacyDeployDir(vaultDir);\n return migrated;\n}\n\nfunction requireLocalConfig(vaultDir: string): TeamLocalConfig {\n const config = readLocalConfig(vaultDir);\n if (config) return config;\n\n console.error(`No local myco-team config found at ${resolveLocalConfigPath(vaultDir)}`);\n process.exit(1);\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function rotateMcpTokenWithRetry(workerUrl: string, apiKey: string): Promise<string> {\n let lastError: Error | null = null;\n\n for (let attempt = 1; attempt <= TEAM_MCP_ROTATION_RETRY_ATTEMPTS; attempt += 1) {\n try {\n return await rotateMcpTokenForWorker(workerUrl, apiKey);\n } catch (error) {\n lastError = error as Error;\n const isRetryable =\n lastError.message.includes('401') &&\n lastError.message.includes('Invalid API key') &&\n attempt < TEAM_MCP_ROTATION_RETRY_ATTEMPTS;\n if (!isRetryable) {\n throw lastError;\n }\n await delay(TEAM_MCP_ROTATION_RETRY_DELAY_MS);\n }\n }\n\n throw lastError ?? new Error('MCP token rotation failed');\n}\n\n/** Run a wrangler command and return stdout. Throws on failure, surfacing stderr. */\nfunction wrangler(args: string[], options?: { cwd?: string }): string {\n return runWrangler(args, { cwd: options?.cwd, timeoutMs: WRANGLER_COMMAND_TIMEOUT_MS });\n}\n\n/** Find the worker source directory. Checks dist layout first (installed), then source layout (dev). */\nfunction locateWorkerSource(): string {\n const root = resolvePackageRoot();\n const distPath = path.join(root, 'dist', WORKER_SOURCE_DIR);\n if (fs.existsSync(distPath)) return distPath;\n const srcPath = path.join(root, WORKER_SOURCE_DIR);\n if (fs.existsSync(srcPath)) return srcPath;\n throw new Error(`Cannot find ${WORKER_SOURCE_DIR} — are you running from the myco-team package?`);\n}\n\n/**\n * Copy worker source to the vault deployment directory and patch wrangler.toml\n * with actual D1 database ID and resource names.\n */\nfunction prepareDeployDir(vaultDir: string, d1Id: string, kvId: string): string {\n const srcDir = locateWorkerSource();\n const deployDir = resolveDeployDir(vaultDir);\n const name = resourceName(vaultDir);\n return stageDeploymentDir({\n sourceDir: srcDir,\n deployDir,\n reset: true,\n textPatches: [{\n filePath: 'wrangler.toml',\n transforms: [\n (toml) => toml.replace(TOML_NAME_REGEX, `name = \"${name}\"`),\n (toml) => toml.replace(TOML_D1_PLACEHOLDER_REGEX, d1Id),\n (toml) => toml.replace(TOML_DB_NAME_REGEX, `database_name = \"${name}\"`),\n (toml) => toml.replace(TOML_INDEX_NAME_REGEX, `index_name = \"${name}-vectors\"`),\n (toml) => toml.replace(TOML_KV_PLACEHOLDER_REGEX, kvId),\n (toml) => toml.replace(TOML_TEAM_PACKAGE_VERSION_REGEX, `MYCO_TEAM_PACKAGE_VERSION = \"${getTeamPackageVersion()}\"`),\n (toml) => toml.replace(TOML_MYCO_SCHEMA_VERSION_REGEX, `MYCO_SCHEMA_VERSION = \"${getMycoSchemaVersion()}\"`),\n ],\n }],\n installDepsTimeoutMs: WRANGLER_COMMAND_TIMEOUT_MS * 3,\n });\n}\n\n/** Ensure a KV namespace exists for this project. Returns the namespace ID. */\nfunction ensureKvNamespace(name: string): string {\n const kvName = `${name}-secrets`;\n const lookupExisting = (): string => {\n const listOutput = wrangler(['kv', 'namespace', 'list']);\n const namespaces = extractJsonArray(listOutput) as Array<{ id: string; title: string }>;\n // Wrangler sometimes rewrites hyphens to underscores in titles\n const normalize = (s: string) => s.replace(/[-_]/g, '');\n const target = normalize(kvName);\n const existing = namespaces.find((ns) => normalize(ns.title) === target || normalize(ns.title).endsWith(target));\n if (!existing) throw new Error(`KV namespace \"${kvName}\" not found in list of ${namespaces.length} namespaces`);\n return existing.id;\n };\n\n try {\n const output = wrangler(['kv', 'namespace', 'create', kvName]);\n return parseKvNamespaceId(output);\n // Created successfully but we couldn't parse — fall back to list lookup\n } catch (err) {\n const errMsg = (err as Error).message;\n if (errMsg.includes('already exists') || errMsg.includes('duplicate') || errMsg.includes('same title')) {\n return lookupExisting();\n }\n throw err;\n }\n}\n\nasync function rotateMcpTokenForWorker(workerUrl: string, apiKey: string): Promise<string> {\n const response = await fetch(`${workerUrl}/mcp/rotate`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${apiKey}`,\n 'Content-Type': 'application/json',\n },\n });\n if (!response.ok) {\n throw new Error(`MCP token rotation failed: ${response.status} ${await response.text()}`);\n }\n const body = await response.json() as { token?: string };\n if (!body.token) {\n throw new Error('MCP token rotation response did not include a token');\n }\n return body.token;\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport async function teamInit(vaultDir: string): Promise<void> {\n console.log('Provisioning team sync infrastructure...\\n');\n\n // 1. Check for wrangler\n try {\n const version = wrangler(['--version']).trim();\n console.log(`wrangler: ${version}`);\n } catch {\n console.error('Error: wrangler CLI not found. Install it with: npm install -g wrangler');\n process.exit(1);\n }\n\n // 2. Check auth\n try {\n wrangler(['whoami']);\n console.log('Cloudflare auth: OK\\n');\n } catch {\n console.error('Error: Not authenticated with Cloudflare. Run: wrangler login');\n process.exit(1);\n }\n\n const name = resourceName(vaultDir);\n console.log(`Resource name: ${name}\\n`);\n\n // 3. Create D1 database (or reuse existing)\n console.log('Creating D1 database...');\n let d1Id: string;\n try {\n const d1Output = wrangler(['d1', 'create', name]);\n d1Id = parseD1Id(d1Output);\n console.log(`D1 database created: ${d1Id}\\n`);\n } catch (err) {\n const errMsg = (err as Error).message;\n if (errMsg.includes('already exists')) {\n console.log('D1 database already exists, looking up ID...');\n const listOutput = wrangler(['d1', 'list', '--json']);\n const databases = JSON.parse(listOutput) as Array<{ name: string; uuid: string }>;\n const existing = databases.find((db) => db.name === name);\n if (!existing) {\n console.error(`D1 database \"${name}\" reported as existing but not found in list`);\n process.exit(1);\n }\n d1Id = existing.uuid;\n console.log(`Reusing D1 database: ${d1Id}\\n`);\n } else {\n console.error(`Failed to create D1 database: ${errMsg}`);\n process.exit(1);\n }\n }\n\n // 4. Create Vectorize index (or reuse existing)\n console.log('Creating Vectorize index...');\n try {\n wrangler(['vectorize', 'create', `${name}-vectors`, '--dimensions', VECTORIZE_DIMENSIONS, '--metric', VECTORIZE_METRIC]);\n console.log('Vectorize index created\\n');\n } catch (err) {\n const errMsg = (err as Error).message;\n if (errMsg.includes('already exists') || errMsg.includes('duplicate_name')) {\n console.log('Vectorize index already exists, reusing\\n');\n } else {\n console.error(`Failed to create Vectorize index: ${errMsg}`);\n process.exit(1);\n }\n }\n\n // 5. Create KV namespace for runtime secrets (MCP tokens)\n console.log('Creating KV namespace for secrets...');\n let kvId: string;\n try {\n kvId = ensureKvNamespace(name);\n console.log(`KV namespace ready: ${kvId}\\n`);\n } catch (err) {\n console.error(`Failed to create KV namespace: ${(err as Error).message}`);\n process.exit(1);\n }\n\n // 6. Generate API key\n const apiKey = crypto.randomBytes(API_KEY_BYTES).toString('hex');\n\n // 7. Prepare deployment directory\n console.log('Preparing worker deployment...');\n const deployDir = prepareDeployDir(vaultDir, d1Id, kvId);\n\n // 7. Set API key secret via wrangler\n console.log('Setting API key secret...');\n try {\n runWrangler(['secret', 'put', TEAM_API_KEY_SECRET, '--name', name], {\n cwd: deployDir,\n input: apiKey,\n timeoutMs: WRANGLER_COMMAND_TIMEOUT_MS,\n });\n console.log('Secret set\\n');\n } catch (err) {\n console.error(`Failed to set API key secret: ${(err as Error).message}`);\n process.exit(1);\n }\n\n // 8. Deploy worker\n console.log('Deploying worker...');\n let workerUrl: string;\n try {\n const deployOutput = wrangler(['deploy'], { cwd: deployDir });\n workerUrl = parseWorkerUrl(deployOutput);\n console.log(`Worker deployed: ${workerUrl}\\n`);\n } catch (err) {\n console.error(`Failed to deploy worker: ${(err as Error).message}`);\n process.exit(1);\n }\n\n // 9. Seed team config in the Worker\n console.log('Setting team configuration...');\n try {\n const { getMachineId } = await import('@myco/daemon/machine-id.js');\n const creatorMachineId = await getMachineId(vaultDir);\n await fetch(`${workerUrl}/config`, {\n method: 'PUT',\n headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },\n body: JSON.stringify({\n team_name: name,\n embedding_model: '@cf/baai/bge-m3',\n embedding_dimensions: '1024',\n created_at: String(Math.floor(Date.now() / 1000)),\n created_by: creatorMachineId,\n }),\n });\n console.log('Team config saved\\n');\n } catch {\n console.log('Warning: could not seed team config (non-fatal)\\n');\n }\n\n let mcpToken: string | null = null;\n try {\n mcpToken = await rotateMcpTokenForWorker(workerUrl, apiKey);\n } catch {\n // Non-fatal. The daemon can also fetch the token later through /connect.\n }\n\n // 10. Save config and API key locally\n updateTeamConfig(vaultDir, {\n enabled: true,\n worker_url: workerUrl,\n });\n writeSecret(vaultDir, TEAM_API_KEY_SECRET, apiKey);\n if (mcpToken) writeSecret(vaultDir, TEAM_MCP_TOKEN_SECRET, mcpToken);\n writeLocalConfig(vaultDir, {\n worker_name: name,\n worker_url: workerUrl,\n package_version: getTeamPackageVersion(),\n created_at: new Date().toISOString(),\n last_upgraded: new Date().toISOString(),\n config_version: TEAM_CONFIG_VERSION,\n });\n\n console.log('Team sync configured!\\n');\n console.log(` URL: ${workerUrl}`);\n console.log(` API Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`);\n if (mcpToken) {\n console.log(` MCP: ${mcpToken.slice(0, 8)}...${mcpToken.slice(-4)}`);\n }\n console.log('\\nShare the URL and API key with teammates so they can connect.');\n}\n\n// ---------------------------------------------------------------------------\n// Shared upgrade logic (used by CLI and daemon API)\n// ---------------------------------------------------------------------------\n\nexport interface UpgradeResult {\n success: boolean;\n worker_url?: string;\n version?: string;\n error?: string;\n}\n\n/**\n * Upgrade the team sync worker: re-copy source, patch config, redeploy.\n * Returns a result instead of calling process.exit — safe for both CLI and daemon.\n */\nexport function upgradeWorker(vaultDir: string): UpgradeResult {\n const config = loadConfig(vaultDir);\n if (!config.team.worker_url) {\n return { success: false, error: 'No team sync configured. Run: myco team init' };\n }\n\n migrateLegacyDeployDir(vaultDir);\n const deployDir = resolveDeployDir(vaultDir);\n const tomlPath = path.join(deployDir, 'wrangler.toml');\n\n if (!fs.existsSync(tomlPath)) {\n return { success: false, error: 'No deployment directory found. Run: myco team init' };\n }\n\n // Read ALL existing resource identifiers from current wrangler.toml.\n const existingToml = fs.readFileSync(tomlPath, 'utf-8');\n const d1Match = existingToml.match(TOML_DB_ID_REGEX);\n if (!d1Match || d1Match[1] === '<YOUR_D1_DATABASE_ID>') {\n return { success: false, error: 'Cannot determine D1 database ID from existing deployment. Run: myco team init' };\n }\n const d1Id = d1Match[1];\n\n const nameMatch = existingToml.match(/^name\\s*=\\s*\"([^\"]*)\"/m);\n const dbNameMatch = existingToml.match(/database_name\\s*=\\s*\"([^\"]*)\"/);\n const indexNameMatch = existingToml.match(/index_name\\s*=\\s*\"([^\"]*)\"/);\n const workerName = nameMatch?.[1] ?? resourceName(vaultDir);\n\n // KV namespace may not exist on older deployments — create or reuse.\n const kvMatch = existingToml.match(TOML_KV_ID_REGEX);\n let kvId: string;\n if (kvMatch) {\n kvId = kvMatch[1];\n } else {\n try {\n kvId = ensureKvNamespace(workerName);\n } catch (err) {\n return { success: false, error: `Failed to provision KV namespace: ${(err as Error).message}` };\n }\n }\n\n try {\n stageDeploymentDir({\n sourceDir: locateWorkerSource(),\n deployDir,\n textPatches: [{\n filePath: 'wrangler.toml',\n transforms: [\n (toml) => toml.replace(TOML_NAME_REGEX, `name = \"${workerName}\"`),\n (toml) => toml.replace(TOML_D1_PLACEHOLDER_REGEX, d1Id),\n (toml) => toml.replace(TOML_DB_NAME_REGEX, `database_name = \"${dbNameMatch?.[1] ?? workerName}\"`),\n (toml) => toml.replace(TOML_INDEX_NAME_REGEX, `index_name = \"${indexNameMatch?.[1] ?? `${workerName}-vectors`}\"`),\n (toml) => toml.replace(TOML_KV_PLACEHOLDER_REGEX, kvId),\n (toml) => toml.replace(TOML_TEAM_PACKAGE_VERSION_REGEX, `MYCO_TEAM_PACKAGE_VERSION = \"${getTeamPackageVersion()}\"`),\n (toml) => toml.replace(TOML_MYCO_SCHEMA_VERSION_REGEX, `MYCO_SCHEMA_VERSION = \"${getMycoSchemaVersion()}\"`),\n ],\n }],\n installDepsTimeoutMs: WRANGLER_COMMAND_TIMEOUT_MS * 3,\n });\n } catch (err) {\n return { success: false, error: `Failed to install worker dependencies: ${(err as Error).message}` };\n }\n\n // Re-set API key secret before deploy (deploy can wipe secrets)\n const secrets = readSecrets(vaultDir);\n const apiKey = secrets[TEAM_API_KEY_SECRET];\n if (apiKey) {\n try {\n runWrangler(['secret', 'put', TEAM_API_KEY_SECRET, '--name', workerName], {\n cwd: deployDir,\n input: apiKey,\n timeoutMs: WRANGLER_COMMAND_TIMEOUT_MS,\n });\n } catch {\n // Non-fatal — secret may already be set\n }\n }\n\n // Redeploy\n try {\n const deployOutput = wrangler(['deploy'], { cwd: deployDir });\n const workerUrl = parseWorkerUrl(deployOutput);\n const version = getTeamPackageVersion();\n\n updateTeamConfig(vaultDir, {\n worker_url: workerUrl,\n });\n const localConfig = readLocalConfig(vaultDir);\n if (localConfig) {\n writeLocalConfig(vaultDir, {\n ...localConfig,\n worker_name: workerName,\n worker_url: workerUrl,\n package_version: version,\n last_upgraded: new Date().toISOString(),\n });\n }\n\n return { success: true, worker_url: workerUrl, version };\n } catch (err) {\n return { success: false, error: `Failed to deploy worker: ${(err as Error).message}` };\n }\n}\n\n// ---------------------------------------------------------------------------\n// CLI wrapper\n// ---------------------------------------------------------------------------\n\nexport async function teamUpgrade(vaultDir: string): Promise<void> {\n console.log('Upgrading team sync worker...\\n');\n const result = upgradeWorker(vaultDir);\n if (!result.success) {\n console.error(result.error);\n process.exit(1);\n }\n console.log(`Worker deployed: ${result.worker_url}`);\n console.log(`Version: ${result.version}`);\n console.log('\\nUpgrade complete.');\n}\n\nexport async function teamStatus(vaultDir: string): Promise<void> {\n const config = requireLocalConfig(vaultDir);\n const secrets = readSecrets(vaultDir);\n\n console.log(`Worker: ${config.worker_name}`);\n console.log(`URL: ${config.worker_url}`);\n console.log(`API Key: ${maskSecret(secrets[TEAM_API_KEY_SECRET] ?? null)}`);\n console.log(`MCP Token: ${maskSecret(secrets[TEAM_MCP_TOKEN_SECRET] ?? null)}`);\n console.log(`Package v: ${config.package_version}`);\n console.log(`Created: ${config.created_at}`);\n console.log(`Upgraded: ${config.last_upgraded}`);\n console.log(`Config v: ${config.config_version}`);\n}\n\nexport async function teamRotateTokens(vaultDir: string, which: 'api' | 'mcp' | 'all' = 'all'): Promise<void> {\n const config = requireLocalConfig(vaultDir);\n const secrets = readSecrets(vaultDir);\n let currentApiKey = secrets[TEAM_API_KEY_SECRET] ?? '';\n let currentMcpToken = secrets[TEAM_MCP_TOKEN_SECRET] ?? null;\n\n let nextConfig = { ...config };\n\n if (which === 'api' || which === 'all') {\n const apiKey = crypto.randomBytes(API_KEY_BYTES).toString('hex');\n runWrangler(['secret', 'put', TEAM_API_KEY_SECRET, '--name', config.worker_name], {\n cwd: resolveDeployDir(vaultDir),\n input: apiKey,\n timeoutMs: WRANGLER_COMMAND_TIMEOUT_MS,\n });\n writeSecret(vaultDir, TEAM_API_KEY_SECRET, apiKey);\n currentApiKey = apiKey;\n nextConfig = {\n ...nextConfig,\n package_version: getTeamPackageVersion(),\n last_upgraded: new Date().toISOString(),\n };\n writeLocalConfig(vaultDir, nextConfig);\n }\n\n if (which === 'mcp' || which === 'all') {\n try {\n currentMcpToken = await rotateMcpTokenWithRetry(config.worker_url, currentApiKey);\n if (currentMcpToken) writeSecret(vaultDir, TEAM_MCP_TOKEN_SECRET, currentMcpToken);\n } catch (error) {\n writeLocalConfig(vaultDir, {\n ...nextConfig,\n last_upgraded: new Date().toISOString(),\n });\n throw new Error(\n `API key rotation completed, but MCP token rotation failed. Local config was updated to the new API key.\\n${(error as Error).message}`,\n );\n }\n }\n\n nextConfig.last_upgraded = new Date().toISOString();\n writeLocalConfig(vaultDir, nextConfig);\n\n console.log(`API Key: ${maskSecret(currentApiKey)}`);\n console.log(`MCP Token: ${maskSecret(currentMcpToken)}`);\n}\n\nexport async function teamDestroy(vaultDir: string): Promise<void> {\n const config = requireLocalConfig(vaultDir);\n const errors: string[] = [];\n const deployDir = resolveDeployDir(vaultDir);\n\n try {\n wrangler(['delete', config.worker_name], { cwd: deployDir });\n } catch (error) {\n errors.push(`worker delete failed: ${(error as Error).message}`);\n }\n\n try {\n wrangler(['vectorize', 'delete', `${config.worker_name}-vectors`]);\n } catch (error) {\n errors.push(`vectorize delete failed: ${(error as Error).message}`);\n }\n\n try {\n const databases = JSON.parse(wrangler(['d1', 'list', '--json'])) as Array<{ name: string; uuid: string }>;\n const database = databases.find((entry) => entry.name === config.worker_name);\n if (database) {\n wrangler(['d1', 'delete', database.name, '--skip-confirmation']);\n }\n } catch (error) {\n errors.push(`d1 delete failed: ${(error as Error).message}`);\n }\n\n try {\n const namespaces = extractJsonArray(wrangler(['kv', 'namespace', 'list'])) as Array<{ id: string; title: string }>;\n const namespace = namespaces.find((entry) => entry.title === `${config.worker_name}-secrets`);\n if (namespace) {\n wrangler(['kv', 'namespace', 'delete', '--namespace-id', namespace.id, '--skip-confirmation']);\n }\n } catch (error) {\n errors.push(`kv delete failed: ${(error as Error).message}`);\n }\n\n if (errors.length > 0) {\n throw new Error(`Team destroy incomplete. Local state preserved for retry.\\n${errors.join('\\n')}`);\n }\n\n fs.rmSync(path.join(vaultDir, TEAM_STATE_DIR), { recursive: true, force: true });\n console.log(`Destroyed local myco-team state for ${config.worker_name}.`);\n}\n","/**\n * Secrets file utilities for API key storage outside git.\n *\n * Secrets are stored in `secrets.env` inside the vault directory.\n * This file is gitignored (see VAULT_GITIGNORE) and never committed.\n * Format: KEY=value, one per line (same as .env).\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst SECRETS_FILE = 'secrets.env';\n\n/** Read all secrets from <vault>/secrets.env as key-value pairs. */\nexport function readSecrets(vaultDir: string): Record<string, string> {\n const secretsPath = path.join(vaultDir, SECRETS_FILE);\n if (!fs.existsSync(secretsPath)) return {};\n\n const secrets: Record<string, string> = {};\n for (const line of fs.readFileSync(secretsPath, 'utf-8').split('\\n')) {\n const match = line.match(/^\\s*([^#=]+?)\\s*=\\s*(.*?)\\s*$/);\n if (match) {\n secrets[match[1]] = match[2];\n }\n }\n return secrets;\n}\n\n/** Write a secret to <vault>/secrets.env, preserving existing entries. */\nexport function writeSecret(vaultDir: string, key: string, value: string): void {\n const secretsPath = path.join(vaultDir, SECRETS_FILE);\n const existing = readSecrets(vaultDir);\n existing[key] = value;\n\n const content = Object.entries(existing)\n .map(([k, v]) => `${k}=${v}`)\n .join('\\n') + '\\n';\n\n fs.writeFileSync(secretsPath, content, 'utf-8');\n}\n\n/** Remove one or more secrets from <vault>/secrets.env, preserving remaining entries. */\nexport function deleteSecrets(vaultDir: string, keys: string[]): void {\n const secretsPath = path.join(vaultDir, SECRETS_FILE);\n if (!fs.existsSync(secretsPath)) return;\n\n const existing = readSecrets(vaultDir);\n for (const key of keys) delete existing[key];\n\n const entries = Object.entries(existing);\n if (entries.length === 0) {\n fs.rmSync(secretsPath, { force: true });\n return;\n }\n\n const content = entries\n .map(([k, v]) => `${k}=${v}`)\n .join('\\n') + '\\n';\n\n fs.writeFileSync(secretsPath, content, 'utf-8');\n}\n\n/** Load secrets from <vault>/secrets.env into process.env (without overwriting existing vars). */\nexport function loadSecrets(vaultDir: string): void {\n const secrets = readSecrets(vaultDir);\n for (const [key, value] of Object.entries(secrets)) {\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n}\n","import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst WORKER_URL_REGEX = /(https:\\/\\/[^\\s]+\\.workers\\.dev)/;\nconst D1_ID_JSON_REGEX = /\"database_id\"\\s*:\\s*\"([0-9a-f-]{36})\"/i;\nconst D1_ID_TEXT_REGEX = /id:\\s*([0-9a-f-]{36})/i;\nconst KV_ID_REGEX = /\"id\":\\s*\"([0-9a-f]+)\"/i;\n\nexport interface WranglerOptions {\n cwd?: string;\n input?: string;\n timeoutMs: number;\n}\n\nexport interface TextPatch {\n filePath: string;\n transforms: Array<(text: string) => string>;\n}\n\nexport interface StageDeploymentDirOptions {\n sourceDir: string;\n deployDir: string;\n reset?: boolean;\n extraCopies?: Array<{ sourceDir: string; destinationSubdir: string }>;\n textPatches?: TextPatch[];\n installDepsTimeoutMs?: number | null;\n}\n\nexport function buildCommandEnv(): NodeJS.ProcessEnv {\n const nodeBinDir = path.dirname(process.execPath);\n const pathValue = process.env.PATH\n ? `${nodeBinDir}${path.delimiter}${process.env.PATH}`\n : nodeBinDir;\n return { ...process.env, PATH: pathValue };\n}\n\nexport function runWrangler(args: string[], options: WranglerOptions): string {\n try {\n return execFileSync('wrangler', args, {\n cwd: options.cwd,\n env: buildCommandEnv(),\n input: options.input,\n encoding: 'utf-8',\n timeout: options.timeoutMs,\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n } catch (error) {\n const execError = error as Error & { stderr?: Buffer | string; stdout?: Buffer | string };\n const stderr = execError.stderr?.toString() ?? '';\n const stdout = execError.stdout?.toString() ?? '';\n const detail = [stderr, stdout].filter(Boolean).join('\\n').trim();\n throw new Error(detail || execError.message);\n }\n}\n\nexport function installDeploymentDeps(deployDir: string, timeoutMs: number): void {\n const packageJsonPath = path.join(deployDir, 'package.json');\n if (!fs.existsSync(packageJsonPath)) return;\n\n execFileSync('npm', ['install', '--silent', '--no-audit', '--no-fund'], {\n cwd: deployDir,\n env: buildCommandEnv(),\n encoding: 'utf-8',\n timeout: timeoutMs,\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n}\n\nexport function parseWorkerUrl(output: string): string {\n const workerUrl = output.match(WORKER_URL_REGEX)?.[1];\n if (!workerUrl) {\n throw new Error(`Could not parse worker URL from deploy output:\\n${output}`);\n }\n return workerUrl;\n}\n\nexport function parseD1Id(output: string): string {\n const jsonMatch = output.match(D1_ID_JSON_REGEX);\n if (jsonMatch) return jsonMatch[1];\n\n const textMatch = output.match(D1_ID_TEXT_REGEX);\n if (textMatch) return textMatch[1];\n\n throw new Error(`Could not parse D1 database ID from wrangler output:\\n${output}`);\n}\n\nexport function parseKvNamespaceId(output: string): string {\n const kvId = output.match(KV_ID_REGEX)?.[1];\n if (!kvId) {\n throw new Error(`Could not parse KV namespace ID from wrangler output:\\n${output}`);\n }\n return kvId;\n}\n\nexport function extractJsonArray(output: string): unknown[] {\n const start = output.indexOf('[');\n const end = output.lastIndexOf(']');\n if (start === -1 || end === -1 || end < start) {\n throw new Error(`No JSON array found in output:\\n${output}`);\n }\n return JSON.parse(output.slice(start, end + 1)) as unknown[];\n}\n\nexport function stageDeploymentDir(options: StageDeploymentDirOptions): string {\n if (options.reset) {\n fs.rmSync(options.deployDir, { recursive: true, force: true });\n }\n fs.mkdirSync(options.deployDir, { recursive: true });\n fs.cpSync(options.sourceDir, options.deployDir, { recursive: true });\n\n for (const copy of options.extraCopies ?? []) {\n fs.cpSync(copy.sourceDir, path.join(options.deployDir, copy.destinationSubdir), { recursive: true });\n }\n\n for (const patch of options.textPatches ?? []) {\n const absolutePath = path.join(options.deployDir, patch.filePath);\n let nextText = fs.readFileSync(absolutePath, 'utf-8');\n for (const transform of patch.transforms) {\n nextText = transform(nextText);\n }\n fs.writeFileSync(absolutePath, nextText, 'utf-8');\n }\n\n if (options.installDepsTimeoutMs) {\n installDeploymentDeps(options.deployDir, options.installDepsTimeoutMs);\n }\n\n return options.deployDir;\n}\n","import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst MYCO_HOME_OVERRIDE_ENV = 'MYCO_HOME_OVERRIDE';\n\nexport function resolveHomeDir(): string {\n return process.env[MYCO_HOME_OVERRIDE_ENV]?.trim() || os.homedir();\n}\n\nexport function resolveHomeConfigPath(configDir: string, fileName: string): string {\n return path.join(resolveHomeDir(), configDir, fileName);\n}\n\nexport function resolveNamedHomeConfigPath(configDir: string, name: string, fileName: string): string {\n return path.join(resolveHomeDir(), configDir, name, fileName);\n}\n\nexport function resolveVaultConfigPath(vaultDir: string, configDir: string, fileName: string): string {\n return path.join(vaultDir, configDir, fileName);\n}\n\nexport function readJsonConfig<T>(configPath: string): T | null {\n if (!fs.existsSync(configPath)) return null;\n return JSON.parse(fs.readFileSync(configPath, 'utf-8')) as T;\n}\n\nexport function writeJsonConfig(configPath: string, value: unknown): void {\n fs.mkdirSync(path.dirname(configPath), { recursive: true });\n fs.writeFileSync(configPath, `${JSON.stringify(value, null, 2)}\\n`, { encoding: 'utf-8', mode: 0o600 });\n fs.chmodSync(configPath, 0o600);\n}\n\nexport function maskSecret(secret: string | null): string | null {\n if (!secret) return null;\n if (secret.length <= 8) return secret;\n return `${secret.slice(0, 4)}...${secret.slice(-4)}`;\n}\n\nexport function createHexToken(byteLength: number): string {\n return crypto.randomBytes(byteLength).toString('hex');\n}\n"],"mappings":";;;;;;;;;;;;;;;AAOA,OAAOA,aAAY;AACnB,OAAOC,SAAQ;AACf,OAAOC,WAAU;AAC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AY;AAAA,QACZ,iBAAiB;AAAA,QACjB,gBAAe,oBAAI,KAAK,GAAE,YAAY;AAAA,MACxC,CAAC;AAAA,IACH;AAEA,WAAO,EAAE,SAAS,MAAM,YAAY,WAAW,QAAQ;AAAA,EACzD,SAAS,KAAK;AACZ,WAAO,EAAE,SAAS,OAAO,OAAO,4BAA6B,IAAc,OAAO,GAAG;AAAA,EACvF;AACF;AAMA,eAAsB,YAAY,UAAiC;AACjE,UAAQ,IAAI,iCAAiC;AAC7C,QAAM,SAAS,cAAc,QAAQ;AACrC,MAAI,CAAC,OAAO,SAAS;AACnB,YAAQ,MAAM,OAAO,KAAK;AAC1B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,UAAQ,IAAI,oBAAoB,OAAO,UAAU,EAAE;AACnD,UAAQ,IAAI,YAAY,OAAO,OAAO,EAAE;AACxC,UAAQ,IAAI,qBAAqB;AACnC;","names":["crypto","fs","path","fs","path","fs","path","path","fs","crypto","path","fs","path","fs","crypto"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SEARCH_PREVIEW_CHARS,
|
|
7
7
|
SEARCH_RESULTS_DEFAULT_LIMIT
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I54KLC6H.js";
|
|
9
9
|
|
|
10
10
|
// src/db/queries/search.ts
|
|
11
11
|
function fullTextSearch(query, options = {}) {
|
|
@@ -223,4 +223,4 @@ export {
|
|
|
223
223
|
fullTextSearch,
|
|
224
224
|
hydrateSearchResults
|
|
225
225
|
};
|
|
226
|
-
//# sourceMappingURL=chunk-
|
|
226
|
+
//# sourceMappingURL=chunk-GVBVHYOT.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
|
|
|
2
2
|
import {
|
|
3
3
|
getTeamMachineId,
|
|
4
4
|
syncRow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AULBWINA.js";
|
|
6
6
|
import {
|
|
7
7
|
getDatabase
|
|
8
8
|
} from "./chunk-MYX5NCRH.js";
|
|
@@ -316,4 +316,4 @@ export {
|
|
|
316
316
|
getSessionImpact,
|
|
317
317
|
deleteSessionCascade
|
|
318
318
|
};
|
|
319
|
-
//# sourceMappingURL=chunk-
|
|
319
|
+
//# sourceMappingURL=chunk-HQLPB346.js.map
|
|
@@ -3,7 +3,7 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
|
|
|
3
3
|
// src/constants/update.ts
|
|
4
4
|
import path from "path";
|
|
5
5
|
import os from "os";
|
|
6
|
-
var
|
|
6
|
+
var NPM_REGISTRY_BASE_URL = "https://registry.npmjs.org";
|
|
7
7
|
var MYCO_GLOBAL_DIR = path.join(os.homedir(), ".myco");
|
|
8
8
|
var UPDATE_CHECK_CACHE_PATH = path.join(MYCO_GLOBAL_DIR, "last-update-check.json");
|
|
9
9
|
var UPDATE_CONFIG_PATH = path.join(MYCO_GLOBAL_DIR, "update.yaml");
|
|
@@ -13,6 +13,13 @@ var RESTART_REASON_FILENAME = "restart-reason.json";
|
|
|
13
13
|
var UPDATE_CHECK_INTERVAL_HOURS = 6;
|
|
14
14
|
var MS_PER_HOUR = 36e5;
|
|
15
15
|
var NPM_PACKAGE_NAME = "@goondocks/myco";
|
|
16
|
+
var TEAM_PACKAGE_NAME = "@goondocks/myco-team";
|
|
17
|
+
var COLLECTIVE_PACKAGE_NAME = "@goondocks/myco-collective";
|
|
18
|
+
var UPDATE_PACKAGES = [
|
|
19
|
+
{ id: "myco", packageName: NPM_PACKAGE_NAME, displayName: "Myco" },
|
|
20
|
+
{ id: "myco-team", packageName: TEAM_PACKAGE_NAME, displayName: "Myco Team" },
|
|
21
|
+
{ id: "myco-collective", packageName: COLLECTIVE_PACKAGE_NAME, displayName: "Myco Collective" }
|
|
22
|
+
];
|
|
16
23
|
var UPDATE_SCRIPT_DELAY_SECONDS = 2;
|
|
17
24
|
var RELEASE_CHANNELS = ["stable", "beta"];
|
|
18
25
|
var DEFAULT_RELEASE_CHANNEL = "stable";
|
|
@@ -91,11 +98,12 @@ var TEAM_SOURCE_PREFIX = "team:";
|
|
|
91
98
|
var TEAM_SEARCH_TIMEOUT_MS = 3e3;
|
|
92
99
|
var TEAM_HEALTH_TIMEOUT_MS = 5e3;
|
|
93
100
|
var TEAM_API_KEY_SECRET = "MYCO_TEAM_API_KEY";
|
|
101
|
+
var TEAM_MCP_TOKEN_SECRET = "MYCO_TEAM_MCP_TOKEN";
|
|
94
102
|
var WRANGLER_COMMAND_TIMEOUT_MS = 6e4;
|
|
95
103
|
var RESTART_RESPONSE_FLUSH_MS = 500;
|
|
96
104
|
|
|
97
105
|
export {
|
|
98
|
-
|
|
106
|
+
NPM_REGISTRY_BASE_URL,
|
|
99
107
|
MYCO_GLOBAL_DIR,
|
|
100
108
|
UPDATE_CHECK_CACHE_PATH,
|
|
101
109
|
UPDATE_CONFIG_PATH,
|
|
@@ -105,6 +113,7 @@ export {
|
|
|
105
113
|
UPDATE_CHECK_INTERVAL_HOURS,
|
|
106
114
|
MS_PER_HOUR,
|
|
107
115
|
NPM_PACKAGE_NAME,
|
|
116
|
+
UPDATE_PACKAGES,
|
|
108
117
|
UPDATE_SCRIPT_DELAY_SECONDS,
|
|
109
118
|
RELEASE_CHANNELS,
|
|
110
119
|
DEFAULT_RELEASE_CHANNEL,
|
|
@@ -176,7 +185,8 @@ export {
|
|
|
176
185
|
TEAM_SEARCH_TIMEOUT_MS,
|
|
177
186
|
TEAM_HEALTH_TIMEOUT_MS,
|
|
178
187
|
TEAM_API_KEY_SECRET,
|
|
188
|
+
TEAM_MCP_TOKEN_SECRET,
|
|
179
189
|
WRANGLER_COMMAND_TIMEOUT_MS,
|
|
180
190
|
RESTART_RESPONSE_FLUSH_MS
|
|
181
191
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-I54KLC6H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/update.ts","../src/constants.ts"],"sourcesContent":["import path from 'node:path';\nimport os from 'node:os';\n\n/** npm registry base URL for Myco packages. */\nexport const NPM_REGISTRY_BASE_URL = 'https://registry.npmjs.org';\n\n/** Global Myco directory for machine-wide state. */\nexport const MYCO_GLOBAL_DIR = path.join(os.homedir(), '.myco');\n\n/** Path to the cached update check result. */\nexport const UPDATE_CHECK_CACHE_PATH = path.join(MYCO_GLOBAL_DIR, 'last-update-check.json');\n\n/** Path to the update configuration file (channel, interval). */\nexport const UPDATE_CONFIG_PATH = path.join(MYCO_GLOBAL_DIR, 'update.yaml');\n\n/** Path to the update error file (written by update script on failure). */\nexport const UPDATE_ERROR_PATH = path.join(MYCO_GLOBAL_DIR, 'update-error.json');\n\n/** Filename for the version stamp written by `myco update` (lives inside vault .myco/). */\nexport const UPDATE_STAMP_FILENAME = 'last-update-version';\n\n/** Filename for the restart reason signal file (lives inside vault .myco/). */\nexport const RESTART_REASON_FILENAME = 'restart-reason.json';\n\n/** Default check interval in hours. */\nexport const UPDATE_CHECK_INTERVAL_HOURS = 6;\n\n/** Milliseconds per hour. */\nexport const MS_PER_HOUR = 3_600_000;\n\n/** Primary Myco npm package name. */\nexport const NPM_PACKAGE_NAME = '@goondocks/myco';\n\n/** Optional standalone Myco Team package name. */\nexport const TEAM_PACKAGE_NAME = '@goondocks/myco-team';\n\n/** Optional standalone Myco Collective package name. */\nexport const COLLECTIVE_PACKAGE_NAME = '@goondocks/myco-collective';\n\n/** Global-package update targets shown in the Operations UI. */\nexport const UPDATE_PACKAGES = [\n { id: 'myco', packageName: NPM_PACKAGE_NAME, displayName: 'Myco' },\n { id: 'myco-team', packageName: TEAM_PACKAGE_NAME, displayName: 'Myco Team' },\n { id: 'myco-collective', packageName: COLLECTIVE_PACKAGE_NAME, displayName: 'Myco Collective' },\n] as const;\nexport type UpdatePackageId = (typeof UPDATE_PACKAGES)[number]['id'];\n\n/** Delay in seconds before update script starts (allows daemon to exit). */\nexport const UPDATE_SCRIPT_DELAY_SECONDS = 2;\n\n/** Valid release channels. */\nexport const RELEASE_CHANNELS = ['stable', 'beta'] as const;\nexport type ReleaseChannel = (typeof RELEASE_CHANNELS)[number];\n\n/** Default release channel. */\nexport const DEFAULT_RELEASE_CHANNEL: ReleaseChannel = 'stable';\n","/**\n * Shared constants for the Myco codebase.\n * Per CLAUDE.md: \"No Magic Literals — Numeric and string constants\n * MUST NOT appear inline in logic.\"\n */\n\nexport { LOG_KINDS, type LogKind, kindToComponent } from './constants/log-kinds.js';\n\n// --- Agent phase prompt composition ---\n/**\n * Maximum chars per phase summary passed to subsequent phases.\n * Set to 4000 to ensure the digest-assess phase findings pass\n * untruncated to parallel tier phases.\n */\nexport const PHASE_SUMMARY_MAX_CHARS = 4000;\n\n// --- Token estimation ---\n/** Approximate characters per token for the chars/4 heuristic. */\nexport const CHARS_PER_TOKEN = 4;\n\n/** Estimate token count from character length using the CHARS_PER_TOKEN heuristic. */\nexport function estimateTokens(text: string): number {\n return Math.ceil(text.length / CHARS_PER_TOKEN);\n}\n\n// --- Time (primitives — must precede derived constants) ---\n/** Milliseconds per second. */\nexport const MS_PER_SECOND = 1000;\n\n// --- Embedding ---\n/** Max characters of text sent to the embedding model. */\nexport const EMBEDDING_INPUT_LIMIT = 8000;\n\n/** Max rows per embedding worker cycle. */\nexport const EMBEDDING_BATCH_SIZE = 10;\n\n/** Content hash algorithm for staleness detection. */\nexport const CONTENT_HASH_ALGORITHM = 'sha256';\n\n// --- Truncation limits (display/preview) ---\n/** Max chars for a user prompt preview in event summaries. */\nexport const PROMPT_PREVIEW_CHARS = 300;\n/** Max chars for an AI response preview in event summaries. */\nexport const AI_RESPONSE_PREVIEW_CHARS = 500;\n/** Max chars for a command string preview. */\nexport const COMMAND_PREVIEW_CHARS = 80;\n/** Max chars for a content snippet in search results. */\nexport const CONTENT_SNIPPET_CHARS = 120;\n/** Max chars for a tool output preview in hooks. */\nexport const TOOL_OUTPUT_PREVIEW_CHARS = 200;\n/** Max chars for a session summary preview in MCP tools. */\nexport const SESSION_SUMMARY_PREVIEW_CHARS = 300;\n/** Max chars for a recall summary preview. */\nexport const RECALL_SUMMARY_PREVIEW_CHARS = 200;\n/** Max chars for search result and hydrated context previews. */\nexport const SEARCH_PREVIEW_CHARS = 300;\n\n// --- Log preview limits (short previews for structured log fields) ---\n/** Max chars for a user prompt preview in log entries. */\nexport const LOG_PROMPT_PREVIEW_CHARS = 50;\n/** Max chars for an assistant message preview in log entries. */\nexport const LOG_MESSAGE_PREVIEW_CHARS = 80;\n\n// --- Context injection layer budgets (chars, not tokens — used with .slice()) ---\nexport const CONTEXT_SESSION_PREVIEW_CHARS = 80;\nexport const CONTEXT_SPORE_PREVIEW_CHARS = 80;\n\n// --- Processor maxTokens budgets ---\n/** Response token budget for observation extraction. */\nexport const EXTRACTION_MAX_TOKENS = 2048;\n/** Response token budget for session summary. */\nexport const SUMMARY_MAX_TOKENS = 512;\n/** Response token budget for session title generation. */\nexport const TITLE_MAX_TOKENS = 32;\n\n// --- Timeouts ---\n/** Daemon client HTTP request timeout (ms). */\nexport const DAEMON_CLIENT_TIMEOUT_MS = 2000;\n/** Health check timeout (ms) — fail fast if daemon isn't responding. */\nexport const DAEMON_HEALTH_CHECK_TIMEOUT_MS = 500;\n/** LLM request timeout (ms). All LLM calls are background daemon work — no need to be aggressive. */\nexport const LLM_REQUEST_TIMEOUT_MS = 180_000;\n/** Embedding request timeout (ms). Embeddings run in background batch processing — generous timeout. */\nexport const EMBEDDING_REQUEST_TIMEOUT_MS = 60_000;\n/** Digest LLM request timeout (ms). Digest cycles use large context windows and may need model loading time. */\nexport const DIGEST_LLM_REQUEST_TIMEOUT_MS = 600_000;\n/** Stdin read timeout for hooks (ms). */\nexport const STDIN_TIMEOUT_MS = 100;\n/** Provider detection timeout for detect-providers CLI command (ms). */\nexport const PROVIDER_DETECT_TIMEOUT_MS = 3000;\n\n// --- Time ---\n/** Milliseconds in one day. */\nexport const MS_PER_DAY = 24 * 60 * 60 * 1000;\n\n/** Current Unix epoch in seconds. */\nexport function epochSeconds(): number {\n return Math.floor(Date.now() / MS_PER_SECOND);\n}\n\n// --- Buffer cleanup ---\n/** Max age for stale buffer files before cleanup (ms). */\nexport const STALE_BUFFER_MAX_AGE_MS = 1 * MS_PER_DAY;\n\n// --- Retry backoff ---\n/** Retry delays for daemon health check (ms). */\nexport const DAEMON_HEALTH_RETRY_DELAYS = [100, 200, 400, 800, 1500];\n\n/** Grace period after daemon.json is written before stale checks can trigger a restart (ms).\n * Prevents rapid restart loops from concurrent hooks or session reloads. */\nexport const DAEMON_STALE_GRACE_PERIOD_MS = 60_000;\n\n/** Grace period for SIGTERM before escalating to SIGKILL (ms).\n * Gives the old daemon a chance to shut down cleanly, but force-kills\n * to guarantee the configured port is reclaimed. */\nexport const DAEMON_EVICT_TIMEOUT_MS = 3000;\n/** Poll interval when waiting for an evicted daemon to die (ms). */\nexport const DAEMON_EVICT_POLL_MS = 100;\n\n// --- Slug limits ---\n/** Max length for slugified artifact IDs. */\n\n// --- Turn rendering ---\n/** Max file paths displayed per turn in session notes. */\nexport const TURN_MAX_FILES_DISPLAYED = 10;\n\n// --- Transcript mining ---\n/** Minimum content length to consider a transcript entry meaningful. */\nexport const MIN_TRANSCRIPT_CONTENT_LENGTH = 10;\n\n// --- Graph edge types (lineage — auto-created by daemon) ---\n/** Spore was extracted during this session. */\nexport const EDGE_TYPE_FROM_SESSION = 'FROM_SESSION';\n/** Spore was extracted from this prompt batch. */\nexport const EDGE_TYPE_EXTRACTED_FROM = 'EXTRACTED_FROM';\n/** Wisdom spore was derived from (consolidated) this source spore. */\nexport const EDGE_TYPE_DERIVED_FROM = 'DERIVED_FROM';\n/** Session contains this prompt batch. */\nexport const EDGE_TYPE_HAS_BATCH = 'HAS_BATCH';\n// --- Query defaults ---\n/** Default row limit for query module list operations. */\nexport const QUERY_DEFAULT_LIST_LIMIT = 100;\n/** Default LIMIT for paginated list queries. */\nexport const DEFAULT_LIST_LIMIT = 50;\n/** Default confidence score for graph edges. */\nexport const GRAPH_EDGE_DEFAULT_CONFIDENCE = 1.0;\n\n// --- Query limits ---\n/** Max recent sessions to check for lineage heuristics. */\nexport const LINEAGE_RECENT_SESSIONS_LIMIT = 5;\n/** Max related spores to query for session notes. */\nexport const RELATED_SPORES_LIMIT = 50;\n\n// --- Context injection ---\n/** Max spores to inject per prompt. */\nexport const PROMPT_CONTEXT_MAX_SPORES = 3;\n/** Minimum similarity score for prompt context injection (0-1). */\nexport const PROMPT_CONTEXT_MIN_SIMILARITY = 0.3;\n/** Max token budget for session-start context injection. */\nexport const SESSION_CONTEXT_MAX_TOKENS = 500;\n/** Max token budget for per-prompt context injection. */\nexport const PROMPT_CONTEXT_MAX_TOKENS = 300;\n/** Minimum prompt length to trigger context search. */\nexport const PROMPT_CONTEXT_MIN_LENGTH = 10;\n\n/** Over-fetch multiplier for vector search to compensate for post-filtering. */\nexport const PROMPT_VECTOR_OVER_FETCH = 2;\n\n// --- Spore status filtering ---\n/** Spore statuses excluded from search results and context injection. */\nexport const EXCLUDED_SPORE_STATUSES = new Set(['superseded', 'archived']);\n\n// --- Agent identity ---\n/** Default agent ID for the built-in intelligence agent. */\nexport const DEFAULT_AGENT_ID = 'myco-agent';\n/** Agent ID for user-initiated MCP operations. */\nexport const USER_AGENT_ID = 'user';\n/** Agent name for user-initiated MCP operations. */\nexport const USER_AGENT_NAME = 'User (MCP)';\n\n// --- MCP tool defaults ---\n/** Default result limit for myco_search. */\nexport const MCP_SEARCH_DEFAULT_LIMIT = 10;\n/** Default result limit for myco_sessions. */\nexport const MCP_SESSIONS_DEFAULT_LIMIT = 20;\n/** Default result limit for myco_logs. */\nexport const MCP_LOGS_DEFAULT_LIMIT = 50;\n/** Default result limit for myco_skills and myco_skill_candidates. */\nexport const MCP_SKILLS_DEFAULT_LIMIT = 50;\n\n// --- Feed ---\n/** Default number of entries returned by the activity feed. */\nexport const FEED_DEFAULT_LIMIT = 50;\n\n// --- Digest — Tiers ---\n/** Available token-budget tiers for digest synthesis. */\nexport const DIGEST_TIERS = [1500, 5000, 10000] as const;\nexport type DigestTier = (typeof DIGEST_TIERS)[number];\n\n// --- Digest — Context window minimums per tier ---\n/** Minimum context window (tokens) required to run a digest at a given tier. */\nexport const DIGEST_TIER_MIN_CONTEXT: Record<number, number> = {\n 1500: 6500,\n 5000: 18500,\n 10000: 30500,\n};\n\n// --- Digest — Substrate ---\n/** Default minimum substrate notes required before a digest cycle runs. */\nexport const DIGEST_MIN_NOTES_FOR_CYCLE = 10;\n\n/** Scoring weights by note type when selecting substrate for synthesis. */\nexport const DIGEST_SUBSTRATE_TYPE_WEIGHTS: Record<string, number> = {\n session: 3,\n spore: 3,\n plan: 2,\n artifact: 1,\n team: 1,\n};\n\n// --- LLM reasoning control ---\n/** Reasoning mode for all Myco LLM calls. Suppresses chain-of-thought tokens from reasoning models. */\nexport const LLM_REASONING_MODE = 'off' as const;\n\n// --- Digest — System prompt overhead estimate ---\n\n// --- Vault intelligence ---\n/** Max candidate spores after post-filtering for supersession check. */\nexport const SUPERSESSION_CANDIDATE_LIMIT = 5;\n\n/** Over-fetch from vector index before post-filtering by status/type. */\nexport const SUPERSESSION_VECTOR_FETCH_LIMIT = 20;\n\n/** Max output tokens for supersession LLM evaluation. */\nexport const SUPERSESSION_MAX_TOKENS = 256;\n\n/** Similarity threshold for clustering related spores in batch agent processing. */\nexport const AGENT_CLUSTER_SIMILARITY = 0.75;\n\n// --- Search ---\n/** Default number of results returned by vector search and fullTextSearch. */\nexport const SEARCH_RESULTS_DEFAULT_LIMIT = 20;\n/** Minimum cosine similarity score for semantic search results (0-1). */\nexport const SEARCH_SIMILARITY_THRESHOLD = 0.3;\n\n// --- Pipeline processing ---\n/** Default page size for pipeline items API listing. */\nexport const PIPELINE_ITEMS_DEFAULT_LIMIT = 50;\n\n// --- Pipeline retry ---\n/** Max retries for parse (structural) pipeline failures — fail fast. */\nexport const PIPELINE_PARSE_MAX_RETRIES = 1;\n/** Exponential backoff multiplier for successive pipeline retries. */\nexport const PIPELINE_BACKOFF_MULTIPLIER = 4;\n\n// --- Pipeline stages (ordered) ---\nexport const PIPELINE_STAGES = ['capture', 'extraction', 'embedding', 'consolidation', 'digest'] as const;\nexport type PipelineStage = typeof PIPELINE_STAGES[number];\n\n// --- Pipeline statuses ---\nexport const PIPELINE_STATUSES = ['pending', 'processing', 'succeeded', 'failed', 'blocked', 'skipped', 'poisoned'] as const;\nexport type PipelineStatus = typeof PIPELINE_STATUSES[number];\n\n// --- Provider roles for circuit breakers ---\nexport const PIPELINE_PROVIDER_ROLES = ['llm', 'embedding', 'digest-llm'] as const;\nexport type PipelineProviderRole = typeof PIPELINE_PROVIDER_ROLES[number];\n\n// --- Stage to provider role mapping ---\nexport const STAGE_PROVIDER_MAP: Record<PipelineStage, PipelineProviderRole | null> = {\n capture: null,\n extraction: 'llm',\n embedding: 'embedding',\n consolidation: 'digest-llm',\n digest: 'digest-llm',\n};\n\n/**\n * Stages processed by the pipeline tick timer.\n * Capture is handled at registration time, digest is gated by the metabolism timer.\n */\nexport const PIPELINE_TICK_STAGES: PipelineStage[] = ['extraction', 'embedding', 'consolidation'];\n\n// --- Item type to applicable stages ---\n// Sessions skip consolidation — consolidation applies to the spores\n// extracted FROM sessions, not the session work item itself.\n// Lineage detection stays outside the pipeline (fire-and-forget, non-critical).\nexport const ITEM_STAGE_MAP: Record<string, PipelineStage[]> = {\n session: ['capture', 'extraction', 'embedding', 'digest'],\n spore: ['capture', 'embedding', 'consolidation', 'digest'],\n artifact: ['capture', 'embedding', 'digest'],\n};\n\n// --- User task registry ---\n/** Subdirectory within the vault for user-created task YAML files. */\nexport const USER_TASKS_DIR = 'tasks';\n\n/** Source label for user-created tasks. */\nexport const USER_TASK_SOURCE = 'user';\n\n/** Source label for built-in tasks shipped with the package. */\nexport const BUILT_IN_SOURCE = 'built-in';\n\n/** Task name validation pattern (lowercase, hyphens, digits). */\nexport const TASK_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;\n\n/** Maximum length for task names. */\nexport const MAX_TASK_NAME_LENGTH = 50;\n\n// --- Automatic consolidation ---\n/** Minimum cluster size required before asking LLM to consolidate. */\nexport const CONSOLIDATION_MIN_CLUSTER_SIZE = 3;\n\n/** Over-fetch from vector index before post-filtering by status/type. */\nexport const CONSOLIDATION_VECTOR_FETCH_LIMIT = 20;\n\n/** Max output tokens for consolidation LLM synthesis.\n * Must be large enough for the full JSON response including content field. */\nexport const CONSOLIDATION_MAX_TOKENS = 2048;\n\n// --- Power management ---\n/** PowerManager states valid for task scheduling (excludes deep_sleep which halts all ticks). */\nexport const SCHEDULABLE_POWER_STATES = ['active', 'idle', 'sleep'] as const;\nexport type SchedulablePowerState = typeof SCHEDULABLE_POWER_STATES[number];\n\n/** Time without activity before transitioning to idle (ms). */\nexport const POWER_IDLE_THRESHOLD_MS = 5 * 60 * MS_PER_SECOND;\n/** Time without activity before transitioning to sleep (ms). */\nexport const POWER_SLEEP_THRESHOLD_MS = 30 * 60 * MS_PER_SECOND;\n/** Time without activity before transitioning to deep sleep (ms). */\nexport const POWER_DEEP_SLEEP_THRESHOLD_MS = 90 * 60 * MS_PER_SECOND;\n/** Job cycle interval during active/idle states (ms). */\nexport const POWER_ACTIVE_INTERVAL_MS = 60 * MS_PER_SECOND;\n/** Job cycle interval during sleep state (ms). */\nexport const POWER_SLEEP_INTERVAL_MS = 5 * 60 * MS_PER_SECOND;\n\n// --- Session maintenance ---\n/** Time without new prompts before an active session is auto-completed (ms). */\nexport const STALE_SESSION_THRESHOLD_MS = 60 * 60 * MS_PER_SECOND;\n/**\n * Max prompt count for a session to be considered dead and auto-deleted.\n *\n * Set to 0: only sessions that were registered but never received a prompt\n * are eligible for dead-session cleanup. A session with even ONE real user\n * prompt has produced captured state worth preserving — the user did work,\n * the agent likely responded, tool calls may have happened, code may have\n * changed. Deleting such a session was a real data-loss failure mode seen\n * during opencode testing where a 1-prompt session that made an actual\n * committed code change was auto-deleted within a minute of TUI exit.\n */\nexport const DEAD_SESSION_MAX_PROMPTS = 0;\n\n// --- Init wizard ---\n/** Minimum Node.js major version required by Myco. */\nexport const MIN_NODE_MAJOR_VERSION = 22;\n\n/** Recommended context window for local intelligence models. */\nexport const RECOMMENDED_LOCAL_CONTEXT_WINDOW = 8192;\n\n/** Default Ollama embedding model recommended during init. */\nexport const DEFAULT_OLLAMA_EMBEDDING_MODEL = 'bge-m3';\n\n/** Default OpenAI embedding model recommended during init. */\nexport const DEFAULT_OPENAI_EMBEDDING_MODEL = 'text-embedding-3-small';\n\n// --- Sync protocol ---\n/** Protocol version for backup and team sync wire format. */\nexport const SYNC_PROTOCOL_VERSION = 1;\n\n// --- Team sync ---\n/** Default machine ID for rows created before multi-machine support. */\nexport const DEFAULT_MACHINE_ID = 'local';\n/** Prefix for team search result source attribution. */\nexport const TEAM_SOURCE_PREFIX = 'team:';\n/** Timeout for team search requests (ms). */\nexport const TEAM_SEARCH_TIMEOUT_MS = 3000;\n/** Timeout for team health check requests (ms). */\nexport const TEAM_HEALTH_TIMEOUT_MS = 5000;\n/** Secrets key for the team API key in secrets.env. */\nexport const TEAM_API_KEY_SECRET = 'MYCO_TEAM_API_KEY';\n/** Secrets key for the team MCP token in secrets.env. */\nexport const TEAM_MCP_TOKEN_SECRET = 'MYCO_TEAM_MCP_TOKEN';\n/** Secrets key for the Collective admin token in secrets.env. */\nexport const COLLECTIVE_ADMIN_TOKEN_SECRET = 'MYCO_COLLECTIVE_ADMIN_TOKEN';\n/** Secrets key for the Collective MCP token in secrets.env. */\nexport const COLLECTIVE_MCP_TOKEN_SECRET = 'MYCO_COLLECTIVE_MCP_TOKEN';\n/** Timeout for wrangler CLI commands (ms). */\nexport const WRANGLER_COMMAND_TIMEOUT_MS = 60_000;\n\n// --- HTTP response flush ---\n/** Delay before initiating shutdown — allows the HTTP response to flush. */\nexport const RESTART_RESPONSE_FLUSH_MS = 500;\n\n// --- Self-update ---\nexport {\n NPM_REGISTRY_BASE_URL,\n MYCO_GLOBAL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;AAE3C,IAAM,gCAAgC,KAAK,KAAK;AAEhD,IAAM,2BAA2B,KAAK;AAEtC,IAAM,0BAA0B,IAAI,KAAK;AAIzC,IAAM,6BAA6B,KAAK,KAAK;AAY7C,IAAM,2BAA2B;AAUjC,IAAM,iCAAiC;AAOvC,IAAM,wBAAwB;AAI9B,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB;AAE3B,IAAM,yBAAyB;AAE/B,IAAM,yBAAyB;AAE/B,IAAM,sBAAsB;AAE5B,IAAM,wBAAwB;AAM9B,IAAM,8BAA8B;AAIpC,IAAM,4BAA4B;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getPluginVersion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-46AQ7D23.js";
|
|
5
5
|
import {
|
|
6
6
|
DAEMON_CLIENT_TIMEOUT_MS,
|
|
7
7
|
DAEMON_HEALTH_CHECK_TIMEOUT_MS,
|
|
8
8
|
DAEMON_HEALTH_RETRY_DELAYS,
|
|
9
9
|
DAEMON_STALE_GRACE_PERIOD_MS
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-I54KLC6H.js";
|
|
11
11
|
|
|
12
12
|
// src/hooks/client.ts
|
|
13
13
|
import fs from "fs";
|
|
@@ -185,4 +185,4 @@ export {
|
|
|
185
185
|
resolveCliEntryPath,
|
|
186
186
|
DaemonClient
|
|
187
187
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-NU74DHV3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-ODXLRR4U.js.map
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
AgentTaskSchema,
|
|
4
4
|
loadAgentTasks,
|
|
5
5
|
taskFromParsed
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YDU3AHSW.js";
|
|
7
7
|
import {
|
|
8
8
|
BUILT_IN_SOURCE,
|
|
9
9
|
MAX_TASK_NAME_LENGTH,
|
|
10
10
|
TASK_NAME_PATTERN,
|
|
11
11
|
USER_TASKS_DIR,
|
|
12
12
|
USER_TASK_SOURCE
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-I54KLC6H.js";
|
|
14
14
|
import {
|
|
15
15
|
require_dist
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6LQIMRTC.js";
|
|
17
17
|
import {
|
|
18
18
|
__toESM
|
|
19
19
|
} from "./chunk-PZUWP5VK.js";
|
|
@@ -100,4 +100,4 @@ export {
|
|
|
100
100
|
deleteUserTask,
|
|
101
101
|
copyTaskToUser
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-OR4XUYBJ.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DAEMON_CLIENT_TIMEOUT_MS,
|
|
4
4
|
EMBEDDING_REQUEST_TIMEOUT_MS,
|
|
5
5
|
LLM_REQUEST_TIMEOUT_MS
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I54KLC6H.js";
|
|
7
7
|
|
|
8
8
|
// src/intelligence/ollama.ts
|
|
9
9
|
var ENDPOINT_GENERATE = "/api/generate";
|
|
@@ -325,4 +325,4 @@ export {
|
|
|
325
325
|
OllamaBackend,
|
|
326
326
|
LmStudioBackend
|
|
327
327
|
};
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
328
|
+
//# sourceMappingURL=chunk-PMT2LSTQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-POEPHBQK.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
|
|
|
2
2
|
import {
|
|
3
3
|
getTeamMachineId,
|
|
4
4
|
syncRow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AULBWINA.js";
|
|
6
6
|
import {
|
|
7
7
|
getDatabase
|
|
8
8
|
} from "./chunk-MYX5NCRH.js";
|
|
@@ -187,4 +187,4 @@ export {
|
|
|
187
187
|
listSporeIdsSince,
|
|
188
188
|
updateSporeStatus
|
|
189
189
|
};
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
190
|
+
//# sourceMappingURL=chunk-PZEAO35P.js.map
|