@octocodeai/octocode-tools-core 16.6.2 → 17.0.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 +29 -55
- package/dist/direct.js +34 -36
- package/dist/github/botFilter.d.ts +1 -0
- package/dist/github/client.d.ts +6 -0
- package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +3 -0
- package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +3 -0
- package/dist/github/directoryFetch/helpers.d.ts +35 -0
- package/dist/github/directoryFetch.d.ts +3 -6
- package/dist/github/fileContentPagination.d.ts +9 -0
- package/dist/github/fileContentProcess.d.ts +1 -8
- package/dist/github/fileContentRaw/fetch.d.ts +20 -0
- package/dist/github/fileContentRaw/pathSuggestions.d.ts +3 -0
- package/dist/github/fileContentRaw.d.ts +2 -12
- package/dist/github/githubAPI.d.ts +4 -1
- package/dist/github/history.d.ts +6 -2
- package/dist/github/issues/fetchers.d.ts +7 -0
- package/dist/github/issues/helpers.d.ts +32 -0
- package/dist/github/issues/orchestrator.d.ts +4 -0
- package/dist/github/issues/types.d.ts +72 -0
- package/dist/github/issues.d.ts +3 -0
- package/dist/github/prContentFetcher/comments.d.ts +11 -0
- package/dist/github/prContentFetcher/commits.d.ts +27 -0
- package/dist/github/prContentFetcher/flags.d.ts +21 -0
- package/dist/github/prContentFetcher/transform.d.ts +5 -0
- package/dist/github/prContentFetcher.d.ts +2 -5
- package/dist/github/pullRequestSearch/restSearch.d.ts +6 -0
- package/dist/github/pullRequestSearch.d.ts +1 -0
- package/dist/github/queryBuilders/base.d.ts +25 -0
- package/dist/github/queryBuilders/codeAndRepo.d.ts +20 -0
- package/dist/github/queryBuilders/issues.d.ts +42 -0
- package/dist/github/queryBuilders/pullRequests.d.ts +13 -0
- package/dist/github/queryBuilders.d.ts +4 -12
- package/dist/github/releases.d.ts +37 -0
- package/dist/github/repoStructure/contentResolution.d.ts +12 -0
- package/dist/github/repoStructure/fetchOrchestration.d.ts +7 -0
- package/dist/github/repoStructure/resultBuilder.d.ts +22 -0
- package/dist/github/repoStructure.d.ts +1 -7
- package/dist/github/repoStructureTree.d.ts +38 -0
- package/dist/github/responseHeaders.d.ts +2 -0
- package/dist/github/searchKeyword.d.ts +2 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +36 -45
- package/dist/oql/adapters/github/execute.d.ts +16 -0
- package/dist/oql/adapters/github/provider-diagnostics.d.ts +14 -0
- package/dist/oql/adapters/github/shared.d.ts +75 -0
- package/dist/oql/adapters/github.d.ts +11 -0
- package/dist/oql/adapters/graphProof.d.ts +6 -0
- package/dist/oql/adapters/graphView/filters.d.ts +25 -0
- package/dist/oql/adapters/graphView/nativeEdges.d.ts +5 -0
- package/dist/oql/adapters/graphView.d.ts +29 -0
- package/dist/oql/adapters/local/code.d.ts +3 -0
- package/dist/oql/adapters/local/codeBoolean.d.ts +3 -0
- package/dist/oql/adapters/local/fileRowOps.d.ts +11 -0
- package/dist/oql/adapters/local/files.d.ts +3 -0
- package/dist/oql/adapters/local/filesBoolean.d.ts +10 -0
- package/dist/oql/adapters/local/filesContentLeaf.d.ts +12 -0
- package/dist/oql/adapters/local/filesUniverse.d.ts +6 -0
- package/dist/oql/adapters/local/findToolType.d.ts +10 -0
- package/dist/oql/adapters/local/predicates.d.ts +18 -0
- package/dist/oql/adapters/local/scope.d.ts +14 -0
- package/dist/oql/adapters/local/searchToolType.d.ts +7 -0
- package/dist/oql/adapters/local/structureContent.d.ts +6 -0
- package/dist/oql/adapters/local/types.d.ts +34 -0
- package/dist/oql/adapters/local.d.ts +3 -7
- package/dist/oql/adapters/researchTargets/diff.d.ts +16 -0
- package/dist/oql/adapters/researchTargets/graph.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/history.d.ts +20 -0
- package/dist/oql/adapters/researchTargets/pagination.d.ts +54 -0
- package/dist/oql/adapters/researchTargets/repositories.d.ts +4 -0
- package/dist/oql/adapters/researchTargets/research.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/rows.d.ts +16 -0
- package/dist/oql/adapters/researchTargets/semantics.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/shared.d.ts +11 -0
- package/dist/oql/adapters/researchTargets.d.ts +4 -46
- package/dist/oql/adapters/resultMap.d.ts +7 -0
- package/dist/oql/adapters/runner.d.ts +7 -0
- package/dist/oql/defaults.d.ts +1 -1
- package/dist/oql/index.js +35 -37
- package/dist/oql/normalize/batch.d.ts +2 -0
- package/dist/oql/normalize/materialize.d.ts +2 -0
- package/dist/oql/normalize/params.d.ts +2 -0
- package/dist/oql/normalize/query.d.ts +2 -0
- package/dist/oql/normalize/scope.d.ts +2 -0
- package/dist/oql/normalize/shared.d.ts +7 -0
- package/dist/oql/normalize/source.d.ts +2 -0
- package/dist/oql/normalize/where.d.ts +2 -0
- package/dist/oql/normalize.d.ts +19 -4
- package/dist/oql/planner/planDiagnostics.d.ts +13 -0
- package/dist/oql/planner/predicateRouting.d.ts +35 -0
- package/dist/oql/predicateUtils.d.ts +3 -0
- package/dist/oql/research/analyze/manifest-scan.d.ts +4 -0
- package/dist/oql/research/analyze/source-graph.d.ts +7 -0
- package/dist/oql/research/analyze/symbol-scoring.d.ts +4 -0
- package/dist/oql/research/analyze/types.d.ts +163 -0
- package/dist/oql/research/analyze/utils.d.ts +16 -0
- package/dist/oql/research/analyze.d.ts +2 -133
- package/dist/oql/research/packets/builders.d.ts +4 -0
- package/dist/oql/research/packets/types.d.ts +91 -0
- package/dist/oql/research/packets.d.ts +21 -80
- package/dist/oql/run/batch.d.ts +3 -0
- package/dist/oql/run/continuations/records.d.ts +19 -0
- package/dist/oql/run/continuations/registry.d.ts +22 -0
- package/dist/oql/run/continuations/semantics.d.ts +3 -0
- package/dist/oql/run/continuations/types.d.ts +12 -0
- package/dist/oql/run/dryRun.d.ts +11 -0
- package/dist/oql/run/paths.d.ts +15 -0
- package/dist/oql/run/proofGrades.d.ts +8 -0
- package/dist/oql/run/select.d.ts +10 -0
- package/dist/oql/run/single.d.ts +22 -0
- package/dist/oql/run.d.ts +4 -31
- package/dist/oql/schema/predicates.d.ts +12 -0
- package/dist/oql/schema.d.ts +74 -43
- package/dist/oql/schemeText.d.ts +21 -23
- package/dist/oql/shorthand/predicates.d.ts +15 -0
- package/dist/oql/shorthand/query-controls.d.ts +18 -0
- package/dist/oql/shorthand/target-params.d.ts +9 -0
- package/dist/oql/shorthand/types.d.ts +159 -0
- package/dist/oql/shorthand/utils.d.ts +7 -0
- package/dist/oql/shorthand.d.ts +2 -171
- package/dist/oql/targetParams.d.ts +0 -13
- package/dist/oql/transformers/github/code.d.ts +1 -9
- package/dist/oql/transformers/github/common.d.ts +7 -1
- package/dist/oql/types/diagnostics.d.ts +22 -0
- package/dist/oql/types/envelope.d.ts +78 -0
- package/dist/oql/types/guards.d.ts +9 -0
- package/dist/oql/types/planner.d.ts +46 -0
- package/dist/oql/types/predicates.d.ts +93 -0
- package/dist/oql/types/query.d.ts +143 -0
- package/dist/oql/types/recordData.d.ts +127 -0
- package/dist/oql/types/recordRows.d.ts +48 -0
- package/dist/oql/types/results.d.ts +118 -0
- package/dist/oql/types/targets.d.ts +22 -0
- package/dist/oql/types.d.ts +17 -630
- package/dist/providers/github/paginationMetadata.d.ts +12 -0
- package/dist/providers/providerResults.d.ts +0 -1
- package/dist/responses.d.ts +4 -35
- package/dist/schema.js +2 -2
- package/dist/scheme/pagination.d.ts +116 -0
- package/dist/scheme/responseEnvelope.d.ts +67 -1
- package/dist/shared/config/index.d.ts +1 -8
- package/dist/shared/config/index.js +1 -2
- package/dist/shared/credentials/index.d.ts +1 -1
- package/dist/shared/credentials/index.js +2 -1
- package/dist/shared/credentials/storage.d.ts +0 -2
- package/dist/shared/credentials/testing.js +1 -1
- package/dist/shared/languageSelectors/classify.d.ts +15 -0
- package/dist/shared/languageSelectors/data.d.ts +12 -0
- package/dist/shared/languageSelectors.d.ts +3 -23
- package/dist/shared/paths.d.ts +4 -4
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -1
- package/dist/shared/session/statsDefaults.d.ts +1 -2
- package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +68 -0
- package/dist/tools/directToolCatalog/toolCommandPatternQueries.d.ts +4 -0
- package/dist/tools/directToolCatalog/toolCommandPatterns.d.ts +4 -0
- package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +12 -0
- package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +19 -0
- package/dist/tools/directToolCatalog.exec.d.ts +5 -0
- package/dist/tools/directToolCatalog.meta.d.ts +10 -67
- package/dist/tools/github_clone_repo/cache.d.ts +1 -5
- package/dist/tools/github_clone_repo/cachePaths.d.ts +5 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +0 -1
- package/dist/tools/github_fetch_content/finalizer/entryParsers.d.ts +9 -0
- package/dist/tools/github_fetch_content/finalizer/types.d.ts +101 -0
- package/dist/tools/github_fetch_content/finalizer.d.ts +1 -7
- package/dist/tools/github_fetch_content/scheme.d.ts +43 -9
- package/dist/tools/github_fetch_content/types.d.ts +1 -2
- package/dist/tools/github_search_code/execution.d.ts +9 -0
- package/dist/tools/github_search_code/finalizer/build.d.ts +4 -0
- package/dist/tools/github_search_code/finalizer/groups.d.ts +23 -0
- package/dist/tools/github_search_code/finalizer/ranking.d.ts +12 -0
- package/dist/tools/github_search_code/finalizer.d.ts +2 -6
- package/dist/tools/github_search_code/scheme.d.ts +31 -6
- package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +68 -0
- package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +52 -0
- package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +17 -0
- package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +63 -0
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +1 -15
- package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/types.d.ts +6 -0
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -4
- package/dist/tools/github_search_pull_requests/scheme.d.ts +11 -2
- package/dist/tools/github_search_repos/execution/pagination.d.ts +39 -0
- package/dist/tools/github_search_repos/execution/queryVariants.d.ts +38 -0
- package/dist/tools/github_search_repos/execution/ranking.d.ts +4 -0
- package/dist/tools/github_search_repos/execution.d.ts +3 -13
- package/dist/tools/github_search_repos/scheme.d.ts +7 -2
- package/dist/tools/github_view_repo_structure/scheme.d.ts +0 -1
- package/dist/tools/github_view_repo_structure/types.d.ts +2 -0
- package/dist/tools/local_fetch_content/fetchContent/extraction.d.ts +15 -0
- package/dist/tools/local_fetch_content/fetchContent/pagination.d.ts +38 -0
- package/dist/tools/local_fetch_content/fetchContent/validation.d.ts +26 -0
- package/dist/tools/local_fetch_content/fetchContent.d.ts +2 -0
- package/dist/tools/local_fetch_content/scheme.d.ts +90 -0
- package/dist/tools/local_find_files/scheme.d.ts +81 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingProfiles.d.ts +70 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +47 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingScoring.d.ts +41 -0
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +16 -95
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/buildResult.d.ts +10 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +46 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +2 -18
- package/dist/tools/local_ripgrep/scheme.d.ts +170 -0
- package/dist/tools/local_view_structure/scheme.d.ts +83 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +56 -8
- package/dist/tools/lsp/semantic_content/semanticAnchored.d.ts +7 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/callEnvelopes.d.ts +5 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +20 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/locationEnvelopes.d.ts +13 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes.d.ts +3 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +24 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/documentSymbols.d.ts +27 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/workspaceSymbolsAndDiagnostics.d.ts +20 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps.d.ts +8 -0
- package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +53 -0
- package/dist/tools/lsp/shared/readiness.d.ts +17 -0
- package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -0
- package/dist/tools/package_search/execution.d.ts +8 -0
- package/dist/tools/package_search/scheme.d.ts +45 -6
- package/dist/tools/providerMappers/codeSearch.d.ts +66 -0
- package/dist/tools/providerMappers/fileContent.d.ts +28 -0
- package/dist/tools/providerMappers/pullRequests.d.ts +158 -0
- package/dist/tools/providerMappers/repoSearch.d.ts +30 -0
- package/dist/tools/providerMappers/repoStructure.d.ts +20 -0
- package/dist/tools/providerMappers/shared.d.ts +23 -0
- package/dist/tools/providerMappers.d.ts +9 -294
- package/dist/tools/toolConfig.d.ts +0 -2
- package/dist/tools/toolMetadata/descriptionOverrides.d.ts +4 -0
- package/dist/tools/toolNames.d.ts +1 -0
- package/dist/tools/toolSchemaImports.d.ts +13 -0
- package/dist/utils/contextUtils.d.ts +5 -16
- package/dist/utils/core/types.d.ts +2 -24
- package/dist/utils/exec/spawn/env.d.ts +5 -0
- package/dist/utils/exec/spawn/wrappers.d.ts +29 -0
- package/dist/utils/exec/spawn.d.ts +2 -34
- package/dist/utils/http/cache/conditional.d.ts +21 -0
- package/dist/utils/http/cache/dataCache.d.ts +6 -0
- package/dist/utils/http/cache/key.d.ts +1 -0
- package/dist/utils/http/cache/management.d.ts +9 -0
- package/dist/utils/http/cache/store.d.ts +28 -0
- package/dist/utils/http/cache.d.ts +4 -16
- package/dist/utils/markdownOutline.d.ts +0 -2
- package/dist/utils/package/npm/npmDeprecation.d.ts +5 -0
- package/dist/utils/package/npm/npmDetailsFetchers.d.ts +15 -0
- package/dist/utils/package/npm/npmMappers.d.ts +12 -0
- package/dist/utils/package/npm/npmRegistry.d.ts +79 -0
- package/dist/utils/package/npm/npmSearchStrategies.d.ts +6 -0
- package/dist/utils/package/npm.d.ts +2 -8
- package/dist/utils/pagination/boundary.d.ts +5 -5
- package/dist/utils/response/bulk/pagination.d.ts +6 -0
- package/dist/utils/response/bulk/queries.d.ts +19 -0
- package/dist/utils/response/bulk/response.d.ts +4 -0
- package/dist/utils/response/bulk.d.ts +2 -5
- package/dist/utils/response/groupedFinalizer.d.ts +7 -2
- package/package.json +10 -3
- package/dist/oql/adapters/v2.d.ts +0 -32
- package/dist/oql/v2params.d.ts +0 -22
- package/dist/shared/config/defaults.d.ts +0 -14
- package/dist/shared/config/loader.d.ts +0 -7
- package/dist/shared/config/resolver.d.ts +0 -2
- package/dist/shared/config/resolverCache.d.ts +0 -12
- package/dist/shared/config/resolverSections.d.ts +0 -10
- package/dist/shared/config/runtimeSurface.d.ts +0 -22
- package/dist/shared/config/types.d.ts +0 -92
- package/dist/shared/config/validator.d.ts +0 -2
- package/dist/shared/credentials/envTokens.d.ts +0 -9
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +0 -24
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +0 -86
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +0 -27
- package/dist/tools/local_binary_inspect/decompressOps.d.ts +0 -16
- package/dist/tools/local_binary_inspect/execution.d.ts +0 -4
- package/dist/tools/local_binary_inspect/scheme.d.ts +0 -47
- package/dist/tools/local_ripgrep/lspBoost.d.ts +0 -54
- package/dist/utils/parsers/ripgrep.d.ts +0 -11
|
@@ -5,5 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
|
|
9
|
-
`;)o++;continue}if(i==="/"&&f==="*"){for(o+=2;o<e.length-1;){if(e[o]==="*"&&e[o+1]==="/"){o+=2;break}o++}continue}n+=i,o++}return n=n.replace(/,(\s*[}\]])/g,"$1"),n}function Oe(e){let n=me(e);return JSON.parse(n)}function he(){return z(y)}async function Re(){return U()}function U(){let e=y;if(!z(e))return{success:!1,error:"Config file does not exist",path:e};try{let n=Ce(e,"utf-8");if(!n.trim())return{success:!0,config:{},path:e};let o=Oe(n),t=D.safeParse(o);return t.success?{success:!0,config:t.data,path:e}:{success:!1,error:`Config file has invalid structure: ${t.error.issues[0]?.message??"unknown error"}`,path:e}}catch(n){return{success:!1,error:`Failed to parse config file: ${n instanceof Error?n.message:"Unknown error"}`,path:e}}}function Te(){return y}function _e(){return F.home}function Ee(e,n){if(e==null)return null;if(typeof e!="string")return`${n}: Must be a string`;try{let o=new URL(e);return["http:","https:"].includes(o.protocol)?null:`${n}: Only http/https URLs allowed`}catch{return`${n}: Invalid URL format`}}function H(e,n,o,t){return e==null?null:typeof e!="number"||isNaN(e)?`${n}: Must be a number`:e<o||e>t?`${n}: Must be between ${o} and ${t}`:null}function J(e,n){return e==null?null:typeof e!="boolean"?`${n}: Must be a boolean`:null}function Q(e,n){if(e==null)return null;if(!Array.isArray(e))return`${n}: Must be an array`;for(let o=0;o<e.length;o++)if(typeof e[o]!="string")return`${n}[${o}]: Must be a string`;return null}function be(e){let n=[];for(let o=0;o<e.length;o++){let t=e[o];typeof t=="string"&&(t.trim()===""?n.push(`local.allowedPaths[${o}]: empty or whitespace-only path`):!t.startsWith("/")&&!t.startsWith("~")?n.push(`local.allowedPaths[${o}]: must be absolute path or start with ~ (got "${t}")`):t.includes("..")&&n.push(`local.allowedPaths[${o}]: path traversal (..) not allowed (got "${t}")`))}return n}function G(e,n){return e===void 0||e===null?null:Q(e,n)}function Y(e,n){return e==null?null:typeof e!="string"?`${n}: Must be a string`:null}function Le(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("github: Must be an object");return}let t=Ee(e.apiUrl,"github.apiUrl");t&&n.push(t)}function Ae(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("local: Must be an object");return}let o=e,t=J(o.enabled,"local.enabled");t&&n.push(t);let r=J(o.enableClone,"local.enableClone");r&&n.push(r);let i=Q(o.allowedPaths,"local.allowedPaths");if(i)n.push(i);else if(Array.isArray(o.allowedPaths)){let f=be(o.allowedPaths);n.push(...f)}if(o.workspaceRoot!==void 0&&o.workspaceRoot!==null){let f=Y(o.workspaceRoot,"local.workspaceRoot");f?n.push(f):typeof o.workspaceRoot=="string"&&!o.workspaceRoot.startsWith("/")&&!o.workspaceRoot.startsWith("~")?n.push('local.workspaceRoot: must be an absolute path or start with ~ (got "'+o.workspaceRoot+'")'):typeof o.workspaceRoot=="string"&&o.workspaceRoot.includes("..")&&n.push('local.workspaceRoot: path traversal (..) not allowed (got "'+o.workspaceRoot+'")')}}function ve(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("tools: Must be an object");return}let o=e,t=G(o.enabled,"tools.enabled");t&&n.push(t);let r=G(o.enableAdditional,"tools.enableAdditional");r&&n.push(r);let i=G(o.disabled,"tools.disabled");i&&n.push(i)}function we(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("network: Must be an object");return}let o=e,t=H(o.timeout,"network.timeout",m,O);t&&n.push(t);let r=H(o.maxRetries,"network.maxRetries",h,R);r&&n.push(r)}function xe(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("lsp: Must be an object");return}let t=Y(e.configPath,"lsp.configPath");t&&n.push(t)}function ye(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("output: Must be an object");return}let o=e;if(o.format!==void 0&&(typeof o.format!="string"?n.push("output.format: Must be a string"):["yaml","json"].includes(o.format)||n.push("output.format: Must be one of: yaml, json")),o.pagination!==void 0&&o.pagination!==null)if(typeof o.pagination!="object"||Array.isArray(o.pagination))n.push("output.pagination: Must be an object");else{let t=o.pagination,r=H(t.defaultCharLength,"output.pagination.defaultCharLength",T,_);r&&n.push(r)}}function q(e){let n=[],o=[];if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Configuration must be a JSON object"],warnings:[]};let t=e;t.version!==void 0&&(typeof t.version!="number"||!Number.isInteger(t.version)?n.push("version: Must be an integer"):t.version>1&&o.push(`version: Config version ${t.version} is newer than supported version ${1}`)),Le(t.github,n),Ae(t.local,n),ve(t.tools,n),we(t.network,n),xe(t.lsp,n),ye(t.output,n);let r=new Set(["$schema","version","github","local","tools","network","lsp","output"]);for(let i of Object.keys(t))r.has(i)||o.push(`Unknown configuration key: ${i}`);return{valid:n.length===0,errors:n,warnings:o,config:n.length===0?e:void 0}}var j="__octocodeRuntimeSurface__";function Ue(e){globalThis[j]=e}function $(){return globalThis[j]??"mcp"}function Ne(){delete globalThis[j]}function Z(e){if(e==null)return;let n=e.trim().toLowerCase();if(n!==""){if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}}function B(e){if(e==null)return;let n=e.trim();if(n==="")return;let o=parseInt(n,10);if(!isNaN(o))return o}function N(e){if(e==null)return;let n=e.trim();if(n!=="")return n.split(",").map(o=>o.trim()).filter(o=>o.length>0)}function ee(e){return{apiUrl:process.env.GITHUB_API_URL?.trim()||e?.apiUrl||A.apiUrl}}function ne(e){let n=$()==="cli",o=Z(process.env.ENABLE_LOCAL),t=Z(process.env.ENABLE_CLONE),r=N(process.env.ALLOWED_PATHS),i=process.env.WORKSPACE_ROOT?.trim()||void 0;return{enabled:o??e?.enabled??l.enabled,enableClone:t??e?.enableClone??(n?!0:l.enableClone),allowedPaths:r??e?.allowedPaths??l.allowedPaths,workspaceRoot:i??e?.workspaceRoot??l.workspaceRoot}}function oe(e){let n=N(process.env.TOOLS_TO_RUN),o=N(process.env.ENABLE_TOOLS),t=N(process.env.DISABLE_TOOLS);return{enabled:n??e?.enabled??d.enabled,enableAdditional:o??e?.enableAdditional??d.enableAdditional,disabled:t??e?.disabled??d.disabled}}function te(e){let n=B(process.env.REQUEST_TIMEOUT),o=B(process.env.MAX_RETRIES),t=n??e?.timeout??C.timeout;t=Math.max(m,Math.min(O,t));let r=o??e?.maxRetries??C.maxRetries;return r=Math.max(h,Math.min(R,r)),{timeout:t,maxRetries:r}}function re(e){return{configPath:(process.env.OCTOCODE_LSP_CONFIG?.trim()||void 0)??e?.configPath??v.configPath}}var Se=new Set(["yaml","json"]);function ie(e){let n=process.env.OCTOCODE_OUTPUT_FORMAT?.trim().toLowerCase(),o=B(process.env.OCTOCODE_OUTPUT_DEFAULT_CHAR_LENGTH),t=n||e?.format||p.format,r=o??e?.pagination?.defaultCharLength??p.pagination.defaultCharLength,i=Math.max(T,Math.min(_,r));return{format:Se.has(t)?t:p.format,pagination:{defaultCharLength:i}}}function W(e,n){let o=e!==void 0,t=process.env.GITHUB_API_URL!==void 0||process.env.ENABLE_LOCAL!==void 0||process.env.ENABLE_CLONE!==void 0||process.env.ALLOWED_PATHS!==void 0||process.env.WORKSPACE_ROOT!==void 0||process.env.TOOLS_TO_RUN!==void 0||process.env.ENABLE_TOOLS!==void 0||process.env.DISABLE_TOOLS!==void 0||process.env.REQUEST_TIMEOUT!==void 0||process.env.MAX_RETRIES!==void 0||process.env.OCTOCODE_LSP_CONFIG!==void 0||process.env.OCTOCODE_OUTPUT_FORMAT!==void 0||process.env.OCTOCODE_OUTPUT_DEFAULT_CHAR_LENGTH!==void 0,r;return o&&t?r="mixed":o?r="file":r="defaults",{version:e?.version??k.version,github:ee(e?.github),local:ne(e?.local),tools:oe(e?.tools),network:te(e?.network),lsp:re(e?.lsp),output:ie(e?.output),source:r,configPath:o?n:void 0}}function S(){let e=U();return e.success&&e.config&&q(e.config).valid?W(e.config,e.path):W(void 0)}async function se(){return S()}var c=null,E=0,ke=6e4;function b(){let e=Date.now();return c&&e-E<ke||(c=S(),E=e),c}async function X(){return b()}async function ue(){return V(),X()}function V(){c=null,E=0}function ae(){c=null,E=0}function fe(){return{cached:c!==null,timestamp:E}}function Ie(e){let n=b(),o=e.split("."),t=n;for(let r of o){if(t==null||typeof t!="object")return;t=t[r]}return t}export{le as CONFIG_FILE_NAME,y as CONFIG_FILE_PATH,L as CONFIG_SCHEMA_VERSION,k as DEFAULT_CONFIG,A as DEFAULT_GITHUB_CONFIG,l as DEFAULT_LOCAL_CONFIG,v as DEFAULT_LSP_CONFIG,C as DEFAULT_NETWORK_CONFIG,p as DEFAULT_OUTPUT_CONFIG,d as DEFAULT_TOOLS_CONFIG,_ as MAX_OUTPUT_DEFAULT_CHAR_LENGTH,R as MAX_RETRIES,O as MAX_TIMEOUT,T as MIN_OUTPUT_DEFAULT_CHAR_LENGTH,h as MIN_RETRIES,m as MIN_TIMEOUT,D as OctocodeConfigSchema,fe as _getCacheState,ae as _resetConfigCache,Ne as _resetRuntimeSurface,he as configExists,X as getConfig,Te as getConfigPath,b as getConfigSync,Ie as getConfigValue,_e as getOctocodeDir,$ as getRuntimeSurface,V as invalidateConfigCache,Re as loadConfig,U as loadConfigSync,ue as reloadConfig,se as resolveConfig,S as resolveConfigSync,Ue as setRuntimeSurface,q as validateConfig};
|
|
8
|
+
import{z as o}from"zod";var n=o.looseObject({$schema:o.string().optional(),version:o.number().int().optional(),github:o.record(o.string(),o.unknown()).optional(),local:o.record(o.string(),o.unknown()).optional(),tools:o.record(o.string(),o.unknown()).optional(),network:o.record(o.string(),o.unknown()).optional(),lsp:o.record(o.string(),o.unknown()).optional(),output:o.record(o.string(),o.unknown()).optional()});import{setRuntimeSurface as a,invalidateConfigCache as l}from"@octocodeai/config";export{n as OctocodeConfigSchema,l as invalidateConfigCache,a as setRuntimeSurface};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { OAuthToken, StoredCredentials, StoreResult, DeleteResult, CredentialsStore, TokenSource, } from './types.js';
|
|
2
|
-
export { storeCredentials, getCredentials, type GetCredentialsOptions, getCredentialsSync, deleteCredentials, updateToken, invalidateCredentialsCache, getToken, getTokenSync, resolveToken, type ResolvedToken, getTokenWithRefresh, type TokenWithRefreshResult, resolveTokenWithRefresh, type ResolvedTokenWithRefresh, refreshAuthToken, type RefreshResult, resolveTokenFull, type FullTokenResolution, type GhCliTokenGetter, resetTokenResolution, listStoredHosts, listStoredHostsSync, hasCredentials, hasCredentialsSync, isTokenExpired, isRefreshTokenExpired, getCredentialsFilePath, readCredentialsStore, encrypt, decrypt, ensureOctocodeDir, OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE,
|
|
2
|
+
export { storeCredentials, getCredentials, type GetCredentialsOptions, getCredentialsSync, deleteCredentials, updateToken, invalidateCredentialsCache, getToken, getTokenSync, resolveToken, type ResolvedToken, getTokenWithRefresh, type TokenWithRefreshResult, resolveTokenWithRefresh, type ResolvedTokenWithRefresh, refreshAuthToken, type RefreshResult, resolveTokenFull, type FullTokenResolution, type GhCliTokenGetter, resetTokenResolution, listStoredHosts, listStoredHostsSync, hasCredentials, hasCredentialsSync, isTokenExpired, isRefreshTokenExpired, getCredentialsFilePath, readCredentialsStore, encrypt, decrypt, ensureOctocodeDir, OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, } from './storage.js';
|
|
3
3
|
export { getGhCliToken } from './ghCli.js';
|
|
@@ -5,4 +5,5 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
function
|
|
8
|
+
function u(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function f(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function S(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var y=new Map,ee=300*1e3;function te(e){let t=u(e),r=y.get(t);return!r||Date.now()-r.cachedAt>=ee?!1:r.credentials?!f(r.credentials):!0}function v(e){e?y.delete(u(e)):y.clear()}function G(e){let t=u(e);if(te(t))return y.get(t).credentials}function I(e,t){let r=u(e);y.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as E,readFileSync as N,writeFileSync as z,unlinkSync as L,statSync as le,chmodSync as ue}from"node:fs";import{createCipheriv as de,createDecipheriv as fe,randomBytes as M}from"node:crypto";import{existsSync as re,mkdirSync as ne}from"node:fs";import{join as c}from"node:path";import{getOctocodeHome as oe}from"@octocodeai/config";var se=448;function ie(){return oe(process.env)}var a=ie(),k={home:a,config:c(a,".octocoderc"),credentials:c(a,"credentials.json"),key:c(a,".key"),session:c(a,"session.json"),stats:c(a,"stats.json"),tmp:c(a,"tmp"),clone:c(a,"tmp","clone"),tree:c(a,"tmp","tree"),repos:c(a,"tmp","clone"),cliConfig:c(a,"config.json"),lspConfig:c(a,"lsp-servers.json")};function W(){re(k.home)||ne(k.home,{recursive:!0,mode:se})}import{z as i}from"zod";var ae=i.object({token:i.string(),tokenType:i.literal("oauth"),scopes:i.array(i.string()).optional(),refreshToken:i.string().optional(),expiresAt:i.string().optional(),refreshTokenExpiresAt:i.string().optional()}),ce=i.object({hostname:i.string(),username:i.string(),token:ae,gitProtocol:i.enum(["ssh","https"]),createdAt:i.string(),updatedAt:i.string()}),j=i.object({version:i.number(),credentials:i.record(i.string(),ce)});var U=k.home,p=k.credentials,d=k.key,B="aes-256-gcm",pe=16;function R(){W()}function $(){if(R(),E(d))return le(d).mode&511&63&&ue(d,384),Buffer.from(N(d,"utf8"),"hex");let e=M(32);return z(d,e.toString("hex"),{mode:384}),e}function w(e){let t=$(),r=M(pe),n=de(B,t,r),o=n.update(e,"utf8","hex");o+=n.final("hex");let s=n.getAuthTag();return`${r.toString("hex")}:${s.toString("hex")}:${o}`}function b(e){let t=$(),[r,n,o]=e.split(":");if(!r||!n||!o)throw new Error("Invalid encrypted data format");let s=Buffer.from(r,"hex"),l=Buffer.from(n,"hex"),m=fe(B,t,s);m.setAuthTag(l);let x=m.update(o,"hex","utf8");return x+=m.final("utf8"),x}function h(){if(R(),!E(p))return{version:1,credentials:{}};try{let e=N(p,"utf8"),t=b(e),r=JSON.parse(t),n=j.safeParse(r);return n.success?n.data:{version:1,credentials:{}}}catch{return{version:1,credentials:{}}}}function D(e){R();let t=w(JSON.stringify(e,null,2));z(p,t,{mode:384})}function K(){try{E(p)&&L(p),E(d)&&L(d)}catch{}}import{refreshToken as he}from"@octokit/oauth-methods";import{request as ge}from"@octokit/request";var T="178c6fc778ccc68e1d6a",g="github.com";function me(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function ke(e){return e==="github.com"||e===g?"https://api.github.com":`https://${e}/api/v3`}async function _(e,t=g,r=T){let n=await e.getCredentials(t);if(!n)return{success:!1,error:`Not logged in to ${t}`};if(!n.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(S(n))return{success:!1,error:"Refresh token has expired. Please login again."};try{let o=await he({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:n.token.refreshToken,request:ge.defaults({baseUrl:ke(t)})}),s={token:o.authentication.token,tokenType:"oauth",refreshToken:o.authentication.refreshToken,expiresAt:o.authentication.expiresAt,refreshTokenExpiresAt:o.authentication.refreshTokenExpiresAt};return await e.updateToken(t,s),{success:!0,username:n.username,hostname:t}}catch(o){return{success:!1,error:o instanceof Error?me(o.message):"Token refresh failed"}}}async function Y(e,t=g,r=T){let n=await e.getCredentials(t);if(!n||!n.token)return{token:null,source:"none"};if(!f(n))return{token:n.token.token,source:"stored",username:n.username};if(n.token.refreshToken){let o=await _(e,t,r);if(o.success){let s=await e.getCredentials(t);if(s?.token.token)return{token:s.token.token,source:"refreshed",username:s.username}}return{token:null,source:"none",refreshError:o.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}import{resolveEnvToken as xe}from"@octocodeai/config";import{execFile as Te}from"child_process";var Ce=["/opt/homebrew/bin","/usr/local/bin","/home/linuxbrew/.linuxbrew/bin"];function P(e){return new Promise(t=>{let r=["auth","token"];e&&r.push("--hostname",e);let n=process.env.PATH??"",o=new Set(n.split(":")),s=Ce.filter(m=>!o.has(m)),l=s.length?`${s.join(":")}:${n}`:n;Te("gh",r,{encoding:"utf8",timeout:5e3,env:{...process.env,PATH:l}},(m,x)=>{if(m||!x){t(null);return}t(x.trim()||null)})})}var A=null;function q(e){A=e}function J(){A=null}function ye(){if(!A)throw new Error("Token resolution not initialized. Call initTokenResolution() first.");return A}async function O(e){let t=e?.hostname??g,r=e?.clientId??T,n=e?.getGhCliToken??P,o=xe();if(o)return{token:o.token,source:o.source,wasRefreshed:!1};let s=await ye().getTokenWithRefresh(t,r);if(s.token)return{token:s.token,source:"octocode-storage",wasRefreshed:s.source==="refreshed",username:s.username};try{let l=await Promise.resolve(n(t));if(l?.trim())return{token:l.trim(),source:"gh-cli",wasRefreshed:!1}}catch(l){process.stderr.write(`[octocode] gh auth token failed: ${l instanceof Error?l.message:String(l)}
|
|
9
|
+
`)}return null}async function V(e=g){let t=await O({hostname:e,getGhCliToken:()=>null});return t?{token:t.token,source:t.source}:null}async function Z(e=g,t=T){let r=await O({hostname:e,clientId:t,getGhCliToken:()=>null});return r?{token:r.token,source:r.source,wasRefreshed:r.wasRefreshed,username:r.username}:null}async function Q(e){let t=u(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let n=h();return n.credentials[t]=r,D(n),v(t),{success:!0}}catch{throw new Error("Failed to store credentials")}}async function C(e="github.com",t){let r=u(e);if(!t?.bypassCache){let s=G(r);if(s!==void 0)return s}let o=h().credentials[r]||null;return I(r,o),o}function F(e="github.com"){let t=u(e);return h().credentials[t]||null}async function Re(e="github.com"){let t=u(e),r=!1,n=h();return n.credentials[t]&&(delete n.credentials[t],Object.keys(n.credentials).length===0?K():D(n),r=!0),v(t),{success:r,deletedFromFile:r}}async function Se(){let e=h();return Object.keys(e.credentials)}function ve(){let e=h();return Object.keys(e.credentials)}async function Ee(e="github.com"){return await C(e)!==null}function Ae(e="github.com"){return F(e)!==null}async function H(e,t){let r=await C(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await Q(r),!0):!1}function Oe(){return p}async function we(e="github.com"){let t=await C(e);return!t||!t.token||f(t)?null:t.token.token}function be(e="github.com"){let t=F(e);return!t||!t.token||f(t)?null:t.token.token}async function De(e,t){return _({getCredentials:C,updateToken:H},e,t)}async function X(e,t){return Y({getCredentials:C,updateToken:H},e,t)}q({getTokenWithRefresh:X});export{p as CREDENTIALS_FILE,d as KEY_FILE,U as OCTOCODE_DIR,b as decrypt,Re as deleteCredentials,w as encrypt,R as ensureOctocodeDir,C as getCredentials,Oe as getCredentialsFilePath,F as getCredentialsSync,P as getGhCliToken,we as getToken,be as getTokenSync,X as getTokenWithRefresh,Ee as hasCredentials,Ae as hasCredentialsSync,v as invalidateCredentialsCache,S as isRefreshTokenExpired,f as isTokenExpired,Se as listStoredHosts,ve as listStoredHostsSync,h as readCredentialsStore,De as refreshAuthToken,J as resetTokenResolution,V as resolveToken,O as resolveTokenFull,Z as resolveTokenWithRefresh,Q as storeCredentials,H as updateToken};
|
|
@@ -3,9 +3,7 @@ import { invalidateCredentialsCache, _getCacheStats, _resetCredentialsCache } fr
|
|
|
3
3
|
import { OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, encrypt, decrypt, ensureOctocodeDir, readCredentialsStore, writeCredentialsStore } from './credentialEncryption.js';
|
|
4
4
|
import { type RefreshResult, type TokenWithRefreshResult } from './tokenRefresh.js';
|
|
5
5
|
import { resolveToken, type ResolvedToken, resolveTokenWithRefresh, type ResolvedTokenWithRefresh, resolveTokenFull, type FullTokenResolution, type GhCliTokenGetter, resetTokenResolution } from './tokenResolution.js';
|
|
6
|
-
import { getTokenFromEnv, getEnvTokenSource, hasEnvToken, ENV_TOKEN_VARS } from './envTokens.js';
|
|
7
6
|
import { isTokenExpired, isRefreshTokenExpired } from './credentialUtils.js';
|
|
8
|
-
export { getTokenFromEnv, getEnvTokenSource, hasEnvToken, ENV_TOKEN_VARS };
|
|
9
7
|
export declare function storeCredentials(credentials: StoredCredentials): Promise<StoreResult>;
|
|
10
8
|
export interface GetCredentialsOptions {
|
|
11
9
|
bypassCache?: boolean;
|
|
@@ -5,4 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
function o(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function s(e){if(!e.token.expiresAt)return!1;let n=new Date(e.token.expiresAt);if(isNaN(n.getTime()))return!0;let t=new Date;return n.getTime()-t.getTime()<300*1e3}var r=new Map,i=300*1e3;function
|
|
8
|
+
function o(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function s(e){if(!e.token.expiresAt)return!1;let n=new Date(e.token.expiresAt);if(isNaN(n.getTime()))return!0;let t=new Date;return n.getTime()-t.getTime()<300*1e3}var r=new Map,i=300*1e3;function a(e){let n=o(e),t=r.get(n);return!t||Date.now()-t.cachedAt>=i?!1:t.credentials?!s(t.credentials):!0}function l(){let e=Date.now();return{size:r.size,entries:Array.from(r.entries()).map(([n,t])=>({hostname:n,age:e-t.cachedAt,valid:a(n)}))}}function c(){r.clear()}import{resolveEnvToken as v}from"@octocodeai/config";import{execFile as k}from"child_process";var u=null;function f(){u=null}export{l as _getCacheStats,c as _resetCredentialsCache,f as resetTokenResolution};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type OqlLanguageSelector } from './data.js';
|
|
2
|
+
export declare function classifyLanguageSelector(raw: string | undefined): OqlLanguageSelector | undefined;
|
|
3
|
+
export type GithubCodeLanguageParams = {
|
|
4
|
+
language?: string;
|
|
5
|
+
extension?: string;
|
|
6
|
+
};
|
|
7
|
+
export type LocalSearchLanguageParams = {
|
|
8
|
+
langType?: string;
|
|
9
|
+
include?: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function toGithubCodeLanguageParams(raw: string | undefined): GithubCodeLanguageParams;
|
|
12
|
+
export declare function toLocalSearchLanguageParams(raw: string | undefined): LocalSearchLanguageParams;
|
|
13
|
+
export declare function toLocalFileLanguageGlobs(raw: string | undefined): string[];
|
|
14
|
+
export declare function toStructuralSearchIncludeGlobs(raw: string | undefined): string[] | undefined;
|
|
15
|
+
export declare function toGithubRepositoryLanguage(raw: string | undefined): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type OqlLanguageSelectorKind = 'extension' | 'language' | 'unknown';
|
|
2
|
+
export type OqlLanguageSelector = {
|
|
3
|
+
raw: string;
|
|
4
|
+
normalized: string;
|
|
5
|
+
kind: OqlLanguageSelectorKind;
|
|
6
|
+
canonicalLanguage?: string;
|
|
7
|
+
extension?: string;
|
|
8
|
+
extensions?: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
export type SelectorDefinition = Omit<OqlLanguageSelector, 'raw' | 'normalized'>;
|
|
11
|
+
export declare const EXTENSION_SELECTORS: Readonly<Record<string, SelectorDefinition>>;
|
|
12
|
+
export declare const LANGUAGE_SELECTORS: Readonly<Record<string, SelectorDefinition>>;
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
export type OqlLanguageSelectorKind
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
normalized: string;
|
|
5
|
-
kind: OqlLanguageSelectorKind;
|
|
6
|
-
canonicalLanguage?: string;
|
|
7
|
-
extension?: string;
|
|
8
|
-
extensions?: readonly string[];
|
|
9
|
-
};
|
|
10
|
-
export declare function classifyLanguageSelector(raw: string | undefined): OqlLanguageSelector | undefined;
|
|
11
|
-
export type GithubCodeLanguageParams = {
|
|
12
|
-
language?: string;
|
|
13
|
-
extension?: string;
|
|
14
|
-
};
|
|
15
|
-
export type LocalSearchLanguageParams = {
|
|
16
|
-
langType?: string;
|
|
17
|
-
include?: string[];
|
|
18
|
-
};
|
|
19
|
-
export declare function toGithubCodeLanguageParams(raw: string | undefined): GithubCodeLanguageParams;
|
|
20
|
-
export declare function toLocalSearchLanguageParams(raw: string | undefined): LocalSearchLanguageParams;
|
|
21
|
-
export declare function toLocalFileLanguageGlobs(raw: string | undefined): string[];
|
|
22
|
-
export declare function toStructuralSearchIncludeGlobs(raw: string | undefined): string[] | undefined;
|
|
23
|
-
export declare function toGithubRepositoryLanguage(raw: string | undefined): string | undefined;
|
|
1
|
+
export type { OqlLanguageSelectorKind, OqlLanguageSelector, } from './languageSelectors/data.js';
|
|
2
|
+
export { classifyLanguageSelector, toGithubCodeLanguageParams, toLocalSearchLanguageParams, toLocalFileLanguageGlobs, toStructuralSearchIncludeGlobs, toGithubRepositoryLanguage, } from './languageSelectors/classify.js';
|
|
3
|
+
export type { GithubCodeLanguageParams, LocalSearchLanguageParams, } from './languageSelectors/classify.js';
|
package/dist/shared/paths.d.ts
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* - macOS: `~/.octocode`
|
|
5
5
|
* - Linux: `${XDG_CONFIG_HOME:-~/.config}/.octocode`
|
|
6
6
|
* - Windows: `%APPDATA%\.octocode`
|
|
7
|
+
*
|
|
8
|
+
* Implementation delegated to @octocodeai/config — single source of truth.
|
|
7
9
|
*/
|
|
8
10
|
export declare function getDefaultOctocodeHome(): string;
|
|
11
|
+
/** Octocode home directory — same as OCTOCODE_HOME, exposed for tool/cache use. */
|
|
12
|
+
export declare function getOctocodeDir(): string;
|
|
9
13
|
export declare const OCTOCODE_HOME: string;
|
|
10
14
|
export declare const paths: {
|
|
11
15
|
readonly home: string;
|
|
@@ -17,9 +21,7 @@ export declare const paths: {
|
|
|
17
21
|
readonly tmp: string;
|
|
18
22
|
readonly clone: string;
|
|
19
23
|
readonly tree: string;
|
|
20
|
-
readonly binary: string;
|
|
21
24
|
readonly repos: string;
|
|
22
|
-
readonly unzip: string;
|
|
23
25
|
readonly cliConfig: string;
|
|
24
26
|
readonly lspConfig: string;
|
|
25
27
|
};
|
|
@@ -28,5 +30,3 @@ export declare function ensureRepos(): void;
|
|
|
28
30
|
export declare function ensureTmp(): void;
|
|
29
31
|
export declare function ensureClone(): void;
|
|
30
32
|
export declare function ensureTree(): void;
|
|
31
|
-
export declare function ensureBinary(): void;
|
|
32
|
-
export declare function ensureUnzip(): void;
|
package/dist/shared/paths.js
CHANGED
|
@@ -5,4 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{existsSync as
|
|
8
|
+
import{existsSync as r,mkdirSync as n}from"node:fs";import{join as o}from"node:path";import{getOctocodeHome as c}from"@octocodeai/config";var s=448;function p(){return c(process.env)}function v(){return e}var e=p(),t={home:e,config:o(e,".octocoderc"),credentials:o(e,"credentials.json"),key:o(e,".key"),session:o(e,"session.json"),stats:o(e,"stats.json"),tmp:o(e,"tmp"),clone:o(e,"tmp","clone"),tree:o(e,"tmp","tree"),repos:o(e,"tmp","clone"),cliConfig:o(e,"config.json"),lspConfig:o(e,"lsp-servers.json")};function m(){r(t.home)||n(t.home,{recursive:!0,mode:s})}function x(){u()}function i(){m(),r(t.tmp)||n(t.tmp,{recursive:!0,mode:s})}function u(){i(),r(t.clone)||n(t.clone,{recursive:!0,mode:s})}function g(){i(),r(t.tree)||n(t.tree,{recursive:!0,mode:s})}export{e as OCTOCODE_HOME,u as ensureClone,m as ensureHome,x as ensureRepos,i as ensureTmp,g as ensureTree,p as getDefaultOctocodeHome,v as getOctocodeDir,t as paths};
|
|
@@ -5,4 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{randomUUID as dt}from"node:crypto";import{existsSync as J,readFileSync as ve,writeFileSync as nt,unlinkSync as ot,renameSync as it}from"node:fs";function h(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function E(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function z(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var P=new Map,we=300*1e3;function Oe(e){let t=h(e),r=P.get(t);return!r||Date.now()-r.cachedAt>=we?!1:r.credentials?!E(r.credentials):!0}function ee(e){e?P.delete(h(e)):P.clear()}function te(e){let t=h(e);if(Oe(t))return P.get(t).credentials}function re(e,t){let r=h(e);P.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as ie,readFileSync as ae,writeFileSync as ce,unlinkSync as Qt,statSync as je,chmodSync as Me}from"node:fs";import{createCipheriv as Be,createDecipheriv as ze,randomBytes as ue}from"node:crypto";import{existsSync as De,mkdirSync as Fe}from"node:fs";import{join as c,resolve as _e}from"node:path";import _ from"node:os";import Le from"node:path";var I=_.platform()==="win32",W=_.platform()==="darwin",He=_.platform()==="linux",T=_.homedir();function K(){return I?process.env.APPDATA||Le.join(T,"AppData","Roaming"):T}var V=".octocode",Ie=448;function se(e){let t=process.env[e];return t&&t.trim().length>0?t:void 0}function Ne(){let e=se("OCTOCODE_HOME");return e?_e(e):I?c(K(),V):W?c(T,V):c(se("XDG_CONFIG_HOME")??c(T,".config"),V)}var u=Ne(),f={home:u,config:c(u,".octocoderc"),credentials:c(u,"credentials.json"),key:c(u,".key"),session:c(u,"session.json"),stats:c(u,"stats.json"),tmp:c(u,"tmp"),clone:c(u,"tmp","clone"),tree:c(u,"tmp","tree"),binary:c(u,"tmp","binary"),repos:c(u,"tmp","clone"),unzip:c(u,"tmp","unzip"),cliConfig:c(u,"config.json"),lspConfig:c(u,"lsp-servers.json")};function ne(){De(f.home)||Fe(f.home,{recursive:!0,mode:Ie})}import{z as a}from"zod";var Ge=a.object({token:a.string(),tokenType:a.literal("oauth"),scopes:a.array(a.string()).optional(),refreshToken:a.string().optional(),expiresAt:a.string().optional(),refreshTokenExpiresAt:a.string().optional()}),Ue=a.object({hostname:a.string(),username:a.string(),token:Ge,gitProtocol:a.enum(["ssh","https"]),createdAt:a.string(),updatedAt:a.string()}),oe=a.object({version:a.number(),credentials:a.record(a.string(),Ue)});var We=f.home,N=f.credentials,k=f.key,le="aes-256-gcm",Ke=16;function x(){ne()}function fe(){if(x(),ie(k))return je(k).mode&511&63&&Me(k,384),Buffer.from(ae(k,"utf8"),"hex");let e=ue(32);return ce(k,e.toString("hex"),{mode:384}),e}function pe(e){let t=fe(),r=ue(Ke),s=Be(le,t,r),n=s.update(e,"utf8","hex");n+=s.final("hex");let i=s.getAuthTag();return`${r.toString("hex")}:${i.toString("hex")}:${n}`}function de(e){let t=fe(),[r,s,n]=e.split(":");if(!r||!s||!n)throw new Error("Invalid encrypted data format");let i=Buffer.from(r,"hex"),C=Buffer.from(s,"hex"),m=ze(le,t,i);m.setAuthTag(C);let Q=m.update(n,"hex","utf8");return Q+=m.final("utf8"),Q}function $(){if(x(),!ie(N))return{version:1,credentials:{}};try{let e=ae(N,"utf8"),t=de(e),r=JSON.parse(t),s=oe.safeParse(r);return s.success?s.data:{version:1,credentials:{}}}catch{return{version:1,credentials:{}}}}function me(e){x();let t=pe(JSON.stringify(e,null,2));ce(N,t,{mode:384})}import{refreshToken as Ve}from"@octokit/oauth-methods";import{request as $e}from"@octokit/request";var G="178c6fc778ccc68e1d6a",A="github.com";function Je(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function qe(e){return e==="github.com"||e===A?"https://api.github.com":`https://${e}/api/v3`}async function he(e,t=A,r=G){let s=await e.getCredentials(t);if(!s)return{success:!1,error:`Not logged in to ${t}`};if(!s.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(z(s))return{success:!1,error:"Refresh token has expired. Please login again."};try{let n=await Ve({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:s.token.refreshToken,request:$e.defaults({baseUrl:qe(t)})}),i={token:n.authentication.token,tokenType:"oauth",refreshToken:n.authentication.refreshToken,expiresAt:n.authentication.expiresAt,refreshTokenExpiresAt:n.authentication.refreshTokenExpiresAt};return await e.updateToken(t,i),{success:!0,username:s.username,hostname:t}}catch(n){return{success:!1,error:n instanceof Error?Je(n.message):"Token refresh failed"}}}async function Se(e,t=A,r=G){let s=await e.getCredentials(t);if(!s||!s.token)return{token:null,source:"none"};if(!E(s))return{token:s.token.token,source:"stored",username:s.username};if(s.token.refreshToken){let n=await he(e,t,r);if(n.success){let i=await e.getCredentials(t);if(i?.token.token)return{token:i.token.token,source:"refreshed",username:i.username}}return{token:null,source:"none",refreshError:n.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}import{execFile as pr}from"child_process";var Ye=null;function ge(e){Ye=e}async function Ze(e){let t=h(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let s=$();return s.credentials[t]=r,me(s),ee(t),{success:!0}}catch{throw new Error("Failed to store credentials")}}async function Ce(e="github.com",t){let r=h(e);if(!t?.bypassCache){let i=te(r);if(i!==void 0)return i}let n=$().credentials[r]||null;return re(r,n),n}async function Xe(e,t){let r=await Ce(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await Ze(r),!0):!1}async function Qe(e,t){return Se({getCredentials:Ce,updateToken:Xe},e,t)}ge({getTokenWithRefresh:Qe});import{z as o}from"zod";var et=o.object({rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),calls:o.number()}),tt=o.object({hits:o.record(o.string(),o.number()).default({}),rateLimits:o.number().default(0)}),U=o.record(o.string(),o.number()).default({}),rt=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:U,rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),charSavingsCalls:o.number(),githubCacheHits:o.number(),githubCacheRateLimits:o.number(),packageRegistryFailures:o.number().default(0),packageRegistryFailuresByRegistry:U}),j=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:U,charsSavedByTool:o.record(o.string(),et).default({}),githubCacheHits:tt.default({hits:{},rateLimits:0}),packageRegistryFailures:U,totalUsage:rt.optional()}),Te=o.object({version:o.literal(1),sessionId:o.string(),createdAt:o.string(),lastActiveAt:o.string(),stats:j.optional()}),ke=o.object({version:o.literal(1),stats:j});function xe(e){return Object.values(e).reduce((t,r)=>t+r,0)}function st(e){let t=e.charsSavedByTool??{},r=e.githubCacheHits??{hits:{},rateLimits:0},s=e.rateLimitsByProvider??{},n=e.packageRegistryFailures??{},i=Object.values(t).reduce((C,m)=>({rawChars:C.rawChars+m.rawChars,responseChars:C.responseChars+m.responseChars,savedChars:C.savedChars+m.savedChars,charSavingsCalls:C.charSavingsCalls+m.calls}),{rawChars:0,responseChars:0,savedChars:0,charSavingsCalls:0});return{toolCalls:e.toolCalls,errors:e.errors,rateLimits:e.rateLimits,rateLimitsByProvider:s,...i,githubCacheHits:xe(r.hits),githubCacheRateLimits:r.rateLimits,packageRegistryFailures:xe(n),packageRegistryFailuresByRegistry:n}}function p(e){let t={...e,rateLimitsByProvider:e.rateLimitsByProvider??{},charsSavedByTool:e.charsSavedByTool??{},githubCacheHits:e.githubCacheHits??{hits:{},rateLimits:0},packageRegistryFailures:e.packageRegistryFailures??{}};return{...t,totalUsage:st(t)}}function w(){return p({toolCalls:0,errors:0,rateLimits:0,rateLimitsByProvider:{},charsSavedByTool:{},githubCacheHits:{hits:{},rateLimits:0},packageRegistryFailures:{}})}var y=f.session,v=f.stats;function ye(e,t){let r=`${e}.tmp`;nt(r,JSON.stringify(t,null,2),{mode:384}),it(r,e)}function at(e){let{stats:t,...r}=e;return r}function ct(e){let t=JSON.parse(e),r=ke.safeParse(t);if(r.success)return p(r.data.stats);let s=j.safeParse(t);return s.success?p(s.data):null}function ut(e){let t=e?p(e):w();if(!J(v))return t;try{let r=ve(v,"utf8"),s=ct(r);return s||t}catch{return t}}function M(e){x(),ye(v,{version:e.version,stats:p(e.stats)}),ye(y,at(e))}function Re(){if(!J(y))return null;try{let e=ve(y,"utf8"),t=JSON.parse(e),r=Te.safeParse(t);return r.success?{...r.data,stats:ut(r.data.stats)}:null}catch{return null}}function be(){let e=!1;for(let t of[y,v])if(J(t))try{ot(t),e=!0}catch{return!1}return e}var lt=6e4,l=null,S=!1,R=null,q=!1,O=null,L=null,H=null,B=!1;function ft(){q||(q=!0,O=()=>{D()},L=()=>{D()},H=()=>{D()},process.on("exit",O),process.on("SIGINT",L),process.on("SIGTERM",H))}function Y(){O&&(process.removeListener("exit",O),O=null),L&&(process.removeListener("SIGINT",L),L=null),H&&(process.removeListener("SIGTERM",H),H=null),q=!1}function pt(){R||(R=setInterval(()=>{S&&l&&(M(l),S=!1)},lt),R.unref())}function Z(){R&&(clearInterval(R),R=null)}function b(){if(l)return l;let e=Re();return e&&(l=e),e}function g(e){l=e,S=!0,ft(),pt()}function F(){S&&l&&(M(l),S=!1)}function D(){if(!B&&S&&l){B=!0;try{M(l),S=!1}catch{}finally{B=!1}}}function X(){l=null,S=!1,B=!1}function Ee(){X(),Z(),Y()}var mt=1;function ht(e){return p(e)}function St(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t)){let i=r[s]??{rawChars:0,responseChars:0,savedChars:0,calls:0};r[s]={rawChars:i.rawChars+n.rawChars,responseChars:i.responseChars+n.responseChars,savedChars:i.savedChars+n.savedChars,calls:i.calls+n.calls}}return r}function Pe(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t))r[s]=(r[s]??0)+n;return r}function gt(e,t){if(!t)return e;let r={...e.hits};for(let[s,n]of Object.entries(t.hits??{}))r[s]=(r[s]??0)+n;return{hits:r,rateLimits:e.rateLimits+(t.rateLimits??0)}}function Ae(){let e=new Date().toISOString();return{version:mt,sessionId:dt(),createdAt:e,lastActiveAt:e,stats:w()}}function Ct(){return b()}function Tt(e){g(e)}function kt(){F()}function xt(){D()}function yt(e){if(e?.forceNew){let s=Ae();return g(s),F(),s}let t=b();if(t){let s={...t,lastActiveAt:new Date().toISOString()};return g(s),F(),s}let r=Ae();return g(r),F(),r}function vt(){return b()?.sessionId??null}function d(e){let t=b();if(!t)return{success:!1,session:null};let r=ht(t.stats),s=p({toolCalls:r.toolCalls+(e.toolCalls??0),errors:r.errors+(e.errors??0),rateLimits:r.rateLimits+(e.rateLimits??0),rateLimitsByProvider:Pe(r.rateLimitsByProvider,e.rateLimitsByProvider),charsSavedByTool:St(r.charsSavedByTool,e.charsSavedByTool),githubCacheHits:gt(r.githubCacheHits,e.githubCacheHits),packageRegistryFailures:Pe(r.packageRegistryFailures,e.packageRegistryFailures)}),n={...t,lastActiveAt:new Date().toISOString(),stats:s};return g(n),{success:!0,session:n}}function Rt(e=1){return d({toolCalls:e})}function bt(e=1){return d({errors:e})}function Et(e=1){return d({rateLimits:e})}function Pt(e,t=1){return d({rateLimits:t,rateLimitsByProvider:{[e]:t}})}function At(e,t,r){let s=Number.isFinite(t)?Math.max(0,t):0,n=Number.isFinite(r)?Math.max(0,r):0;return d({charsSavedByTool:{[e]:{rawChars:s,responseChars:n,savedChars:Math.max(0,s-n),calls:1}}})}function wt(e,t=1){return d({githubCacheHits:{hits:{[e]:t},rateLimits:0}})}function Ot(e=1){return d({githubCacheHits:{hits:{},rateLimits:e}})}function Lt(e,t=1){return d({packageRegistryFailures:{[e]:t}})}function Ht(){let e=b();if(!e)return{success:!1,session:null};let t={...e,lastActiveAt:new Date().toISOString(),stats:w()};return g(t),{success:!0,session:t}}function Dt(){return X(),Z(),Y(),be()}function Ft(){Ee()}export{y as SESSION_FILE,v as STATS_FILE,Ft as _resetSessionState,Dt as deleteSession,kt as flushSession,xt as flushSessionSync,yt as getOrCreateSession,vt as getSessionId,bt as incrementErrors,wt as incrementGitHubCacheHits,Ot as incrementGitHubCacheRateLimits,Lt as incrementPackageRegistryFailures,Pt as incrementRateLimitByProvider,Et as incrementRateLimits,Rt as incrementToolCalls,At as incrementToolCharSavings,Ct as readSession,Ht as resetSessionStats,d as updateSessionStats,Tt as writeSession};
|
|
8
|
+
import{randomUUID as nt}from"node:crypto";import{existsSync as M,readFileSync as Se,writeFileSync as Ye,unlinkSync as Ze,renameSync as Qe}from"node:fs";import{isStatsEnabled as ge}from"@octocodeai/config";function p(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function w(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function B(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var P=new Map,ve=300*1e3;function Re(e){let t=p(e),r=P.get(t);return!r||Date.now()-r.cachedAt>=ve?!1:r.credentials?!w(r.credentials):!0}function q(e){e?P.delete(p(e)):P.clear()}function V(e){let t=p(e);if(Re(t))return P.get(t).credentials}function Y(e,t){let r=p(e);P.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as X,readFileSync as ee,writeFileSync as te,unlinkSync as _t,statSync as He,chmodSync as Oe}from"node:fs";import{createCipheriv as De,createDecipheriv as Ie,randomBytes as re}from"node:crypto";import{existsSync as be,mkdirSync as we}from"node:fs";import{join as u}from"node:path";import{getOctocodeHome as Pe}from"@octocodeai/config";var Ee=448;function Ae(){return Pe(process.env)}var c=Ae(),d={home:c,config:u(c,".octocoderc"),credentials:u(c,"credentials.json"),key:u(c,".key"),session:u(c,"session.json"),stats:u(c,"stats.json"),tmp:u(c,"tmp"),clone:u(c,"tmp","clone"),tree:u(c,"tmp","tree"),repos:u(c,"tmp","clone"),cliConfig:u(c,"config.json"),lspConfig:u(c,"lsp-servers.json")};function Z(){be(d.home)||we(d.home,{recursive:!0,mode:Ee})}import{z as a}from"zod";var Le=a.object({token:a.string(),tokenType:a.literal("oauth"),scopes:a.array(a.string()).optional(),refreshToken:a.string().optional(),expiresAt:a.string().optional(),refreshTokenExpiresAt:a.string().optional()}),Fe=a.object({hostname:a.string(),username:a.string(),token:Le,gitProtocol:a.enum(["ssh","https"]),createdAt:a.string(),updatedAt:a.string()}),Q=a.object({version:a.number(),credentials:a.record(a.string(),Fe)});var _e=d.home,D=d.credentials,T=d.key,se="aes-256-gcm",Ge=16;function y(){Z()}function ne(){if(y(),X(T))return He(T).mode&511&63&&Oe(T,384),Buffer.from(ee(T,"utf8"),"hex");let e=re(32);return te(T,e.toString("hex"),{mode:384}),e}function oe(e){let t=ne(),r=re(Ge),s=De(se,t,r),n=s.update(e,"utf8","hex");n+=s.final("hex");let i=s.getAuthTag();return`${r.toString("hex")}:${i.toString("hex")}:${n}`}function ie(e){let t=ne(),[r,s,n]=e.split(":");if(!r||!s||!n)throw new Error("Invalid encrypted data format");let i=Buffer.from(r,"hex"),k=Buffer.from(s,"hex"),h=Ie(se,t,i);h.setAuthTag(k);let J=h.update(n,"hex","utf8");return J+=h.final("utf8"),J}function N(){if(y(),!X(D))return{version:1,credentials:{}};try{let e=ee(D,"utf8"),t=ie(e),r=JSON.parse(t),s=Q.safeParse(r);return s.success?s.data:{version:1,credentials:{}}}catch{return{version:1,credentials:{}}}}function ae(e){y();let t=oe(JSON.stringify(e,null,2));te(D,t,{mode:384})}import{refreshToken as Ue}from"@octokit/oauth-methods";import{request as je}from"@octokit/request";var I="178c6fc778ccc68e1d6a",E="github.com";function Be(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function Ne(e){return e==="github.com"||e===E?"https://api.github.com":`https://${e}/api/v3`}async function ce(e,t=E,r=I){let s=await e.getCredentials(t);if(!s)return{success:!1,error:`Not logged in to ${t}`};if(!s.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(B(s))return{success:!1,error:"Refresh token has expired. Please login again."};try{let n=await Ue({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:s.token.refreshToken,request:je.defaults({baseUrl:Ne(t)})}),i={token:n.authentication.token,tokenType:"oauth",refreshToken:n.authentication.refreshToken,expiresAt:n.authentication.expiresAt,refreshTokenExpiresAt:n.authentication.refreshTokenExpiresAt};return await e.updateToken(t,i),{success:!0,username:s.username,hostname:t}}catch(n){return{success:!1,error:n instanceof Error?Be(n.message):"Token refresh failed"}}}async function ue(e,t=E,r=I){let s=await e.getCredentials(t);if(!s||!s.token)return{token:null,source:"none"};if(!w(s))return{token:s.token.token,source:"stored",username:s.username};if(s.token.refreshToken){let n=await ce(e,t,r);if(n.success){let i=await e.getCredentials(t);if(i?.token.token)return{token:i.token.token,source:"refreshed",username:i.username}}return{token:null,source:"none",refreshError:n.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}import{resolveEnvToken as Qt}from"@octocodeai/config";import{execFile as qt}from"child_process";var Me=null;function le(e){Me=e}async function ze(e){let t=p(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let s=N();return s.credentials[t]=r,ae(s),q(t),{success:!0}}catch{throw new Error("Failed to store credentials")}}async function de(e="github.com",t){let r=p(e);if(!t?.bypassCache){let i=V(r);if(i!==void 0)return i}let n=N().credentials[r]||null;return Y(r,n),n}async function We(e,t){let r=await de(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await ze(r),!0):!1}async function $e(e,t){return ue({getCredentials:de,updateToken:We},e,t)}le({getTokenWithRefresh:$e});import{z as o}from"zod";var Ke=o.object({rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),calls:o.number()}),Je=o.object({hits:o.record(o.string(),o.number()).default({}),rateLimits:o.number().default(0)}),_=o.record(o.string(),o.number()).default({}),qe=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:_,rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),charSavingsCalls:o.number(),githubCacheHits:o.number(),githubCacheRateLimits:o.number(),packageRegistryFailures:o.number().default(0),packageRegistryFailuresByRegistry:_}),G=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:_,charsSavedByTool:o.record(o.string(),Ke).default({}),githubCacheHits:Je.default({hits:{},rateLimits:0}),packageRegistryFailures:_,totalUsage:qe.optional()}),fe=o.object({version:o.literal(1),sessionId:o.string(),createdAt:o.string(),lastActiveAt:o.string(),stats:G.optional()}),he=o.object({version:o.literal(1),stats:G});function pe(e){return Object.values(e).reduce((t,r)=>t+r,0)}function Ve(e){let t=e.charsSavedByTool??{},r=e.githubCacheHits??{hits:{},rateLimits:0},s=e.rateLimitsByProvider??{},n=e.packageRegistryFailures??{},i=Object.values(t).reduce((k,h)=>({rawChars:k.rawChars+h.rawChars,responseChars:k.responseChars+h.responseChars,savedChars:k.savedChars+h.savedChars,charSavingsCalls:k.charSavingsCalls+h.calls}),{rawChars:0,responseChars:0,savedChars:0,charSavingsCalls:0});return{toolCalls:e.toolCalls,errors:e.errors,rateLimits:e.rateLimits,rateLimitsByProvider:s,...i,githubCacheHits:pe(r.hits),githubCacheRateLimits:r.rateLimits,packageRegistryFailures:pe(n),packageRegistryFailuresByRegistry:n}}function m(e){let t={...e,rateLimitsByProvider:e.rateLimitsByProvider??{},charsSavedByTool:e.charsSavedByTool??{},githubCacheHits:e.githubCacheHits??{hits:{},rateLimits:0},packageRegistryFailures:e.packageRegistryFailures??{}};return{...t,totalUsage:Ve(t)}}function S(){return m({toolCalls:0,errors:0,rateLimits:0,rateLimitsByProvider:{},charsSavedByTool:{},githubCacheHits:{hits:{},rateLimits:0},packageRegistryFailures:{}})}var x=d.session,v=d.stats;function me(e,t){let r=`${e}.tmp`;Ye(r,JSON.stringify(t,null,2),{mode:384}),Qe(r,e)}function Xe(e){let t=JSON.parse(e),r=he.safeParse(t);if(r.success)return m(r.data.stats);let s=G.safeParse(t);return s.success?m(s.data):null}function et(){if(!M(v))return S();try{let e=Se(v,"utf8");return Xe(e)??S()}catch{return S()}}function U(e){y(),ge()&&me(v,{version:e.version,stats:m(e.stats)});let{stats:t,...r}=e;me(x,r)}function Ce(){if(!M(x))return null;try{let e=Se(x,"utf8"),t=JSON.parse(e),r=fe.safeParse(t);return r.success?{...r.data,stats:ge()?et():S()}:null}catch{return null}}function ke(){let e=!1;for(let t of[x,v])if(M(t))try{Ze(t),e=!0}catch{return!1}return e}var tt=6e4,l=null,g=!1,R=null,z=!1,A=null,L=null,F=null,j=!1;function rt(){z||(z=!0,A=()=>{H()},L=()=>{H()},F=()=>{H()},process.on("exit",A),process.on("SIGINT",L),process.on("SIGTERM",F))}function W(){A&&(process.removeListener("exit",A),A=null),L&&(process.removeListener("SIGINT",L),L=null),F&&(process.removeListener("SIGTERM",F),F=null),z=!1}function st(){R||(R=setInterval(()=>{g&&l&&(U(l),g=!1)},tt),R.unref())}function $(){R&&(clearInterval(R),R=null)}function b(){if(l)return l;let e=Ce();return e&&(l=e),e}function C(e){l=e,g=!0,rt(),st()}function O(){g&&l&&(U(l),g=!1)}function H(){if(!j&&g&&l){j=!0;try{U(l),g=!1}catch{}finally{j=!1}}}function K(){l=null,g=!1,j=!1}function Te(){K(),$(),W()}var ot=1;function it(e){return m(e)}function at(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t)){let i=r[s]??{rawChars:0,responseChars:0,savedChars:0,calls:0};r[s]={rawChars:i.rawChars+n.rawChars,responseChars:i.responseChars+n.responseChars,savedChars:i.savedChars+n.savedChars,calls:i.calls+n.calls}}return r}function ye(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t))r[s]=(r[s]??0)+n;return r}function ct(e,t){if(!t)return e;let r={...e.hits};for(let[s,n]of Object.entries(t.hits??{}))r[s]=(r[s]??0)+n;return{hits:r,rateLimits:e.rateLimits+(t.rateLimits??0)}}function xe(){let e=new Date().toISOString();return{version:ot,sessionId:nt(),createdAt:e,lastActiveAt:e,stats:S()}}function ut(){return b()}function lt(e){C(e)}function dt(){O()}function ft(){H()}function ht(e){if(e?.forceNew){let s=xe();return C(s),O(),s}let t=b();if(t){let s={...t,lastActiveAt:new Date().toISOString()};return C(s),O(),s}let r=xe();return C(r),O(),r}function pt(){return b()?.sessionId??null}function f(e){let t=b();if(!t)return{success:!1,session:null};let r=it(t.stats),s=m({toolCalls:r.toolCalls+(e.toolCalls??0),errors:r.errors+(e.errors??0),rateLimits:r.rateLimits+(e.rateLimits??0),rateLimitsByProvider:ye(r.rateLimitsByProvider,e.rateLimitsByProvider),charsSavedByTool:at(r.charsSavedByTool,e.charsSavedByTool),githubCacheHits:ct(r.githubCacheHits,e.githubCacheHits),packageRegistryFailures:ye(r.packageRegistryFailures,e.packageRegistryFailures)}),n={...t,lastActiveAt:new Date().toISOString(),stats:s};return C(n),{success:!0,session:n}}function mt(e=1){return f({toolCalls:e})}function St(e=1){return f({errors:e})}function gt(e=1){return f({rateLimits:e})}function Ct(e,t=1){return f({rateLimits:t,rateLimitsByProvider:{[e]:t}})}function kt(e,t,r){let s=Number.isFinite(t)?Math.max(0,t):0,n=Number.isFinite(r)?Math.max(0,r):0;return f({charsSavedByTool:{[e]:{rawChars:s,responseChars:n,savedChars:Math.max(0,s-n),calls:1}}})}function Tt(e,t=1){return f({githubCacheHits:{hits:{[e]:t},rateLimits:0}})}function yt(e=1){return f({githubCacheHits:{hits:{},rateLimits:e}})}function xt(e,t=1){return f({packageRegistryFailures:{[e]:t}})}function vt(){let e=b();if(!e)return{success:!1,session:null};let t={...e,lastActiveAt:new Date().toISOString(),stats:S()};return C(t),{success:!0,session:t}}function Rt(){return K(),$(),W(),ke()}function bt(){Te()}export{x as SESSION_FILE,v as STATS_FILE,bt as _resetSessionState,Rt as deleteSession,dt as flushSession,ft as flushSessionSync,ht as getOrCreateSession,pt as getSessionId,St as incrementErrors,Tt as incrementGitHubCacheHits,yt as incrementGitHubCacheRateLimits,xt as incrementPackageRegistryFailures,Ct as incrementRateLimitByProvider,gt as incrementRateLimits,mt as incrementToolCalls,kt as incrementToolCharSavings,ut as readSession,vt as resetSessionStats,f as updateSessionStats,lt as writeSession};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SessionStats
|
|
2
|
-
export declare function calculateTotalUsageStats(stats: SessionStats): SessionTotalUsageStats;
|
|
1
|
+
import type { SessionStats } from './types.js';
|
|
3
2
|
export declare function withDerivedUsageTotals(stats: SessionStats): SessionStats;
|
|
4
3
|
export declare function createDefaultStats(): SessionStats;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine-free direct-tool catalog: registry of tool definitions (name +
|
|
3
|
+
* display/bulk zod schemas) plus category/sort/output-field helpers. Split out
|
|
4
|
+
* of `directToolCatalog.meta.ts` (still the public barrel) — see that file's
|
|
5
|
+
* header comment for the full P3 engine-free rationale.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export type DirectToolInput = Record<string, unknown> & {
|
|
9
|
+
queries: unknown[];
|
|
10
|
+
};
|
|
11
|
+
export interface DirectToolDefinition {
|
|
12
|
+
name: string;
|
|
13
|
+
schema: z.ZodType;
|
|
14
|
+
inputSchema: z.ZodType;
|
|
15
|
+
}
|
|
16
|
+
export type DirectToolCategory = 'GitHub' | 'Local Code' | 'Package' | 'Other';
|
|
17
|
+
export declare const DIRECT_TOOL_CATEGORIES: readonly DirectToolCategory[];
|
|
18
|
+
export interface DirectToolDisplayField {
|
|
19
|
+
name: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
type: string;
|
|
22
|
+
/** Numeric bounds and default, e.g. "1-100, default 30" — surfaced inline so
|
|
23
|
+
* agents see the full constraint without fetching the raw JSON schema. */
|
|
24
|
+
constraints?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DirectToolCommandPattern {
|
|
28
|
+
label: string;
|
|
29
|
+
query: Record<string, unknown>;
|
|
30
|
+
command: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DirectToolOutputField {
|
|
33
|
+
name: string;
|
|
34
|
+
type: string;
|
|
35
|
+
optional?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface DirectToolMetadata {
|
|
38
|
+
tools?: Record<string, {
|
|
39
|
+
description?: string;
|
|
40
|
+
schema?: Record<string, string>;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export type DirectToolAutoFilledField = 'id' | 'mainResearchGoal' | 'researchGoal' | 'reasoning';
|
|
44
|
+
export interface PrepareDirectToolInputOptions {
|
|
45
|
+
sourceLabel?: string;
|
|
46
|
+
rejectUnknownFields?: boolean;
|
|
47
|
+
onUnknownFields?: (unknownFields: string[], queryIndex: number) => void;
|
|
48
|
+
}
|
|
49
|
+
export declare class DirectToolInputError extends Error {
|
|
50
|
+
readonly details: string[];
|
|
51
|
+
constructor(message: string, details?: string[]);
|
|
52
|
+
}
|
|
53
|
+
export declare const DIRECT_TOOL_AUTO_FILLED_FIELDS: ReadonlySet<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Engine-free tool definitions (name + display/bulk schema). Order mirrors
|
|
56
|
+
* `ALL_TOOLS` in `toolConfig.ts`; each schema is the SAME object that
|
|
57
|
+
* `toolConfig` attaches an executionFn to. Kept in lockstep by a drift test.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DIRECT_TOOL_DEFINITIONS: DirectToolDefinition[];
|
|
60
|
+
export declare function findDirectToolDefinition(name: string): DirectToolDefinition | undefined;
|
|
61
|
+
export declare function getDirectToolCategory(toolName: string): DirectToolCategory;
|
|
62
|
+
export declare function sortDirectToolNames(toolNames: string[]): string[];
|
|
63
|
+
export declare function formatDirectToolSchemaText(toolName: string): string;
|
|
64
|
+
export declare function formatDirectToolMetadataSchemaText(schema: Record<string, string> | undefined): string;
|
|
65
|
+
export declare function getDirectToolAutoFilledFields(toolName: string): string[];
|
|
66
|
+
export declare function getDirectToolOutputFields(): DirectToolOutputField[];
|
|
67
|
+
export declare function formatDirectToolOutputSchemaText(): string;
|
|
68
|
+
export declare function getDirectToolDescription(toolName: string, metadata?: DirectToolMetadata | null): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DirectToolCommandPattern } from './toolCatalogDefinitions.js';
|
|
2
|
+
export declare function formatDirectToolCommandPattern(toolName: string, query: Record<string, unknown>): string;
|
|
3
|
+
export declare function buildDirectToolCommandPatterns(toolName: string): DirectToolCommandPattern[];
|
|
4
|
+
export declare function buildDirectToolExampleQuery(toolName: string): Record<string, unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input preparation/normalization for the engine-free direct-tool catalog:
|
|
3
|
+
* JSON parsing, envelope handling, default-field filling, field-name alias
|
|
4
|
+
* folding, and unknown-field detection (with did-you-mean suggestions). Split
|
|
5
|
+
* out of `directToolCatalog.meta.ts` (still the public barrel) — see that
|
|
6
|
+
* file's header comment for the full P3 rationale.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { type DirectToolInput, type PrepareDirectToolInputOptions } from './toolCatalogDefinitions.js';
|
|
10
|
+
export declare function prepareDirectToolInputFromJsonText(toolName: string, inputText: string | undefined, options?: PrepareDirectToolInputOptions): DirectToolInput | null;
|
|
11
|
+
export declare function prepareDirectToolInput(toolName: string, rawPayload: unknown, options?: PrepareDirectToolInputOptions): DirectToolInput;
|
|
12
|
+
export declare function formatDirectToolValidationIssues(error: z.ZodError): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type DirectToolDisplayField } from './toolCatalogDefinitions.js';
|
|
2
|
+
interface JsonSchemaObject extends Record<string, unknown> {
|
|
3
|
+
type?: string | string[];
|
|
4
|
+
description?: string;
|
|
5
|
+
enum?: unknown[];
|
|
6
|
+
required?: string[];
|
|
7
|
+
properties?: Record<string, unknown>;
|
|
8
|
+
items?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare function getDirectToolDisplayFields(toolName: string): DirectToolDisplayField[];
|
|
11
|
+
export declare function describeSchemaConstraints(schema: JsonSchemaObject): string | undefined;
|
|
12
|
+
export declare function describeSchemaType(schema: JsonSchemaObject): string;
|
|
13
|
+
export declare function collectDisplayFields(properties: Record<string, unknown>, requiredFields: ReadonlySet<string>, prefix?: string): DirectToolDisplayField[];
|
|
14
|
+
export declare function buildExampleValue(name: string, type: string): unknown;
|
|
15
|
+
export declare function buildScalarExampleValue(name: string, type: string): unknown;
|
|
16
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
17
|
+
export declare function isJsonSchemaObject(value: unknown): value is JsonSchemaObject;
|
|
18
|
+
export declare function hasSchemaDefault(value: unknown): boolean;
|
|
19
|
+
export {};
|
|
@@ -7,5 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
9
9
|
import { DirectToolInputError } from './directToolCatalog.meta.js';
|
|
10
|
+
type InitializeFn = () => Promise<void>;
|
|
11
|
+
/** @internal — test use only; not part of the public API. */
|
|
12
|
+
export declare function _overrideInitialize(fn: InitializeFn): void;
|
|
13
|
+
/** @internal — test use only; not part of the public API. */
|
|
14
|
+
export declare function _resetInitialize(): void;
|
|
10
15
|
export declare function executeDirectTool(name: string, input: unknown): Promise<CallToolResult>;
|
|
11
16
|
export { DirectToolInputError };
|
|
@@ -13,71 +13,14 @@
|
|
|
13
13
|
* which DOES import the engine; it is only reached when a tool actually runs.
|
|
14
14
|
* The `@octocodeai/octocode-tools-core/schema` subpath re-exports only this
|
|
15
15
|
* module so engine-less runtimes (e.g. Codex.app Node) can read schemas.
|
|
16
|
+
*
|
|
17
|
+
* This file is a thin barrel — the implementation is split across sibling
|
|
18
|
+
* modules under `./directToolCatalog/` (registry/helpers, schema
|
|
19
|
+
* introspection, command-pattern construction, and input preparation) purely
|
|
20
|
+
* to keep each file under the repo's max-lines lint budget. No consumer
|
|
21
|
+
* should need to import those sibling modules directly; import from here.
|
|
16
22
|
*/
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export interface DirectToolDefinition {
|
|
22
|
-
name: string;
|
|
23
|
-
schema: z.ZodType;
|
|
24
|
-
inputSchema: z.ZodType;
|
|
25
|
-
}
|
|
26
|
-
export type DirectToolCategory = 'GitHub' | 'Local Code' | 'Package' | 'Other';
|
|
27
|
-
export declare const DIRECT_TOOL_CATEGORIES: readonly DirectToolCategory[];
|
|
28
|
-
export interface DirectToolDisplayField {
|
|
29
|
-
name: string;
|
|
30
|
-
required: boolean;
|
|
31
|
-
type: string;
|
|
32
|
-
/** Numeric bounds and default, e.g. "1-100, default 30" — surfaced inline so
|
|
33
|
-
* agents see the full constraint without fetching the raw JSON schema. */
|
|
34
|
-
constraints?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
}
|
|
37
|
-
export interface DirectToolCommandPattern {
|
|
38
|
-
label: string;
|
|
39
|
-
query: Record<string, unknown>;
|
|
40
|
-
command: string;
|
|
41
|
-
}
|
|
42
|
-
export interface DirectToolOutputField {
|
|
43
|
-
name: string;
|
|
44
|
-
type: string;
|
|
45
|
-
optional?: boolean;
|
|
46
|
-
}
|
|
47
|
-
export interface DirectToolMetadata {
|
|
48
|
-
tools?: Record<string, {
|
|
49
|
-
description?: string;
|
|
50
|
-
schema?: Record<string, string>;
|
|
51
|
-
}>;
|
|
52
|
-
}
|
|
53
|
-
export interface PrepareDirectToolInputOptions {
|
|
54
|
-
sourceLabel?: string;
|
|
55
|
-
rejectUnknownFields?: boolean;
|
|
56
|
-
onUnknownFields?: (unknownFields: string[], queryIndex: number) => void;
|
|
57
|
-
}
|
|
58
|
-
export declare class DirectToolInputError extends Error {
|
|
59
|
-
readonly details: string[];
|
|
60
|
-
constructor(message: string, details?: string[]);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Engine-free tool definitions (name + display/bulk schema). Order mirrors
|
|
64
|
-
* `ALL_TOOLS` in `toolConfig.ts`; each schema is the SAME object that
|
|
65
|
-
* `toolConfig` attaches an executionFn to. Kept in lockstep by a drift test.
|
|
66
|
-
*/
|
|
67
|
-
export declare const DIRECT_TOOL_DEFINITIONS: DirectToolDefinition[];
|
|
68
|
-
export declare function findDirectToolDefinition(name: string): DirectToolDefinition | undefined;
|
|
69
|
-
export declare function getDirectToolCategory(toolName: string): DirectToolCategory;
|
|
70
|
-
export declare function sortDirectToolNames(toolNames: string[]): string[];
|
|
71
|
-
export declare function formatDirectToolSchemaText(toolName: string): string;
|
|
72
|
-
export declare function formatDirectToolMetadataSchemaText(schema: Record<string, string> | undefined): string;
|
|
73
|
-
export declare function getDirectToolAutoFilledFields(toolName: string): string[];
|
|
74
|
-
export declare function getDirectToolOutputFields(): DirectToolOutputField[];
|
|
75
|
-
export declare function formatDirectToolOutputSchemaText(): string;
|
|
76
|
-
export declare function getDirectToolDescription(toolName: string, metadata?: DirectToolMetadata | null): string;
|
|
77
|
-
export declare function getDirectToolDisplayFields(toolName: string): DirectToolDisplayField[];
|
|
78
|
-
export declare function formatDirectToolCommandPattern(toolName: string, query: Record<string, unknown>): string;
|
|
79
|
-
export declare function buildDirectToolCommandPatterns(toolName: string): DirectToolCommandPattern[];
|
|
80
|
-
export declare function buildDirectToolExampleQuery(toolName: string): Record<string, unknown>;
|
|
81
|
-
export declare function prepareDirectToolInputFromJsonText(toolName: string, inputText: string | undefined, options?: PrepareDirectToolInputOptions): DirectToolInput | null;
|
|
82
|
-
export declare function prepareDirectToolInput(toolName: string, rawPayload: unknown, options?: PrepareDirectToolInputOptions): DirectToolInput;
|
|
83
|
-
export declare function formatDirectToolValidationIssues(error: z.ZodError): string[];
|
|
23
|
+
export * from './directToolCatalog/toolCatalogDefinitions.js';
|
|
24
|
+
export * from './directToolCatalog/toolSchemaIntrospection.js';
|
|
25
|
+
export * from './directToolCatalog/toolCommandPatterns.js';
|
|
26
|
+
export * from './directToolCatalog/toolInputPreparation.js';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { CloneCacheMeta, CacheSource } from './types.js';
|
|
2
|
-
export
|
|
3
|
-
export declare function getCloneBaseDir(octocodeDir: string): string;
|
|
4
|
-
export declare function getTreeBaseDir(octocodeDir: string): string;
|
|
5
|
-
export declare function getCloneDir(octocodeDir: string, owner: string, repo: string, branch: string, sparsePath?: string): string;
|
|
6
|
-
export declare function getTreeDir(octocodeDir: string, owner: string, repo: string, branch: string): string;
|
|
2
|
+
export { getReposBaseDir, getCloneBaseDir, getTreeBaseDir, getCloneDir, getTreeDir, } from './cachePaths.js';
|
|
7
3
|
export declare function readCacheMeta(cloneDir: string): CloneCacheMeta | null;
|
|
8
4
|
export declare function writeCacheMeta(cloneDir: string, meta: CloneCacheMeta): void;
|
|
9
5
|
export declare function isCacheValid(meta: CloneCacheMeta): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getReposBaseDir(octocodeDir: string): string;
|
|
2
|
+
export declare function getCloneBaseDir(octocodeDir: string): string;
|
|
3
|
+
export declare function getTreeBaseDir(octocodeDir: string): string;
|
|
4
|
+
export declare function getCloneDir(octocodeDir: string, owner: string, repo: string, branch: string, sparsePath?: string): string;
|
|
5
|
+
export declare function getTreeDir(octocodeDir: string, owner: string, repo: string, branch: string): string;
|
|
@@ -82,7 +82,6 @@ export declare const GitHubCloneRepoOutputLocalSchema: import("zod").ZodObject<{
|
|
|
82
82
|
kind: import("zod").ZodString;
|
|
83
83
|
}, import("zod/v4/core").$loose>]>>>;
|
|
84
84
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
85
|
-
hints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
86
85
|
base: import("zod").ZodOptional<import("zod").ZodString>;
|
|
87
86
|
shared: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>>;
|
|
88
87
|
responsePagination: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PaginationInfo } from '../../../types/toolResults.js';
|
|
2
|
+
import type { DirectoryEntry, FileEntry, PartialFileContentQuery } from './types.js';
|
|
3
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
export declare function readString(value: unknown): string | undefined;
|
|
5
|
+
export declare function readNumber(value: unknown): number | undefined;
|
|
6
|
+
export declare function readStringArray(value: unknown): string[] | undefined;
|
|
7
|
+
export declare function readPagination(value: unknown): PaginationInfo | undefined;
|
|
8
|
+
export declare function readFileEntry(data: Record<string, unknown>, query: PartialFileContentQuery): FileEntry;
|
|
9
|
+
export declare function readDirectoryEntry(data: Record<string, unknown>, query: PartialFileContentQuery): DirectoryEntry;
|