@git.zone/tsdoc 1.12.0 → 2.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.
@@ -5,10 +5,10 @@ import * as aiDocsClasses from './aidocs_classes/index.js';
5
5
  export class AiDoc {
6
6
  private openaiToken: string;
7
7
 
8
- public npmextraKV: plugins.npmextra.KeyValueStore;
8
+ public smartconfigKV: plugins.npmextra.KeyValueStore;
9
9
  public qenvInstance: plugins.qenv.Qenv;
10
10
  public aidocInteract: plugins.smartinteract.SmartInteract;
11
- public smartAiInstance: plugins.smartai.SmartAi;
11
+ public model: plugins.smartai.LanguageModelV3;
12
12
 
13
13
  argvArg: any;
14
14
 
@@ -38,8 +38,8 @@ export class AiDoc {
38
38
  if (!(await this.qenvInstance.getEnvVarOnDemand('OPENAI_TOKEN'))) {
39
39
  // Migrate old KV store path to new path if needed
40
40
  const homeDir = plugins.smartpath.get.home();
41
- const oldKvPath = plugins.path.join(homeDir, '.npmextra/kv/tsdoc.json');
42
- const newKvDir = plugins.path.join(homeDir, '.npmextra/kv/@git.zone');
41
+ const oldKvPath = plugins.path.join(homeDir, '.smartconfig/kv/tsdoc.json');
42
+ const newKvDir = plugins.path.join(homeDir, '.smartconfig/kv/@git.zone');
43
43
  const newKvPath = plugins.path.join(newKvDir, 'tsdoc.json');
44
44
  if (
45
45
  await plugins.fsInstance.file(oldKvPath).exists() &&
@@ -52,13 +52,13 @@ export class AiDoc {
52
52
  console.log('Migration complete: tsdoc.json -> @git.zone/tsdoc.json');
53
53
  }
54
54
 
55
- this.npmextraKV = new plugins.npmextra.KeyValueStore({
55
+ this.smartconfigKV = new plugins.npmextra.KeyValueStore({
56
56
  typeArg: 'userHomeDir',
57
57
  identityArg: '@git.zone/tsdoc',
58
58
  mandatoryKeys: ['OPENAI_TOKEN'],
59
59
  });
60
60
 
61
- const missingKeys = await this.npmextraKV.getMissingMandatoryKeys();
61
+ const missingKeys = await this.smartconfigKV.getMissingMandatoryKeys();
62
62
  if (missingKeys.length > 0) {
63
63
  // lets try argv
64
64
  if (this.argvArg?.OPENAI_TOKEN) {
@@ -77,34 +77,23 @@ export class AiDoc {
77
77
  }
78
78
 
79
79
  this.printSanitizedToken();
80
- await this.npmextraKV.writeKey('OPENAI_TOKEN', this.openaiToken);
80
+ await this.smartconfigKV.writeKey('OPENAI_TOKEN', this.openaiToken);
81
81
  }
82
82
  }
83
- if (!this.openaiToken && this.npmextraKV) {
84
- this.openaiToken = await this.npmextraKV.readKey('OPENAI_TOKEN');
83
+ if (!this.openaiToken && this.smartconfigKV) {
84
+ this.openaiToken = await this.smartconfigKV.readKey('OPENAI_TOKEN');
85
85
  }
86
86
 
87
- // lets assume we have an OPENAI_Token now
88
- this.smartAiInstance = new plugins.smartai.SmartAi({
89
- openaiToken: this.openaiToken,
87
+ // Create model using getModel()
88
+ this.model = plugins.smartai.getModel({
89
+ provider: 'openai',
90
+ model: 'gpt-5.4',
91
+ apiKey: this.openaiToken,
90
92
  });
91
- await this.smartAiInstance.start();
92
93
  }
93
94
 
94
95
  public async stop() {
95
- if (this.smartAiInstance) {
96
- await this.smartAiInstance.stop();
97
- }
98
- // No explicit cleanup needed for npmextraKV or aidocInteract
99
- // They don't keep event loop alive
100
- }
101
-
102
- /**
103
- * Get the OpenAI provider for direct chat calls
104
- * This is a convenience getter to access the provider from SmartAi
105
- */
106
- public get openaiProvider(): plugins.smartai.OpenAiProvider {
107
- return this.smartAiInstance.openaiProvider;
96
+ // No lifecycle management needed with getModel() API
108
97
  }
109
98
 
110
99
  public getOpenaiToken(): string {
@@ -130,7 +119,7 @@ export class AiDoc {
130
119
  const projectContextInstance = new aiDocsClasses.ProjectContext(projectDirArg);
131
120
  return await projectContextInstance.gatherFiles();
132
121
  }
133
-
122
+
134
123
  /**
135
124
  * Get the context with token count information
136
125
  * @param projectDirArg The path to the project directory
@@ -141,7 +130,7 @@ export class AiDoc {
141
130
  await projectContextInstance.update();
142
131
  return projectContextInstance.getContextWithTokenCount();
143
132
  }
144
-
133
+
145
134
  /**
146
135
  * Get just the token count for a project's context
147
136
  * @param projectDirArg The path to the project directory
@@ -152,7 +141,7 @@ export class AiDoc {
152
141
  await projectContextInstance.update();
153
142
  return projectContextInstance.getTokenCount();
154
143
  }
155
-
144
+
156
145
  /**
157
146
  * Estimate token count in a text string
158
147
  * @param text The text to estimate tokens for
package/ts/plugins.ts CHANGED
@@ -4,9 +4,10 @@ import * as path from 'path';
4
4
  export { path };
5
5
 
6
6
  // pushrocks scope
7
- import * as npmextra from '@push.rocks/npmextra';
7
+ import * as npmextra from '@push.rocks/smartconfig';
8
8
  import * as qenv from '@push.rocks/qenv';
9
9
  import * as smartagent from '@push.rocks/smartagent';
10
+ import * as smartagentTools from '@push.rocks/smartagent/tools';
10
11
  import * as smartai from '@push.rocks/smartai';
11
12
  import * as smartcli from '@push.rocks/smartcli';
12
13
  import * as smartdelay from '@push.rocks/smartdelay';
@@ -24,6 +25,7 @@ export {
24
25
  npmextra,
25
26
  qenv,
26
27
  smartagent,
28
+ smartagentTools,
27
29
  smartai,
28
30
  smartcli,
29
31
  smartdelay,