@giovannijecha/jecode 0.1.9 → 0.2.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.
Files changed (42) hide show
  1. package/README.md +36 -18
  2. package/dist/account-lock.js +112 -0
  3. package/dist/accounts.js +100 -0
  4. package/dist/cli-info.js +2 -2
  5. package/dist/commands.js +1 -1
  6. package/dist/controller.js +46 -11
  7. package/dist/credential-commands.js +32 -4
  8. package/dist/credential-safety.js +10 -1
  9. package/dist/effort.js +25 -0
  10. package/dist/external-browser.js +53 -0
  11. package/dist/oauth-http.js +114 -0
  12. package/dist/openai-account-command.js +124 -0
  13. package/dist/openai-account.js +94 -0
  14. package/dist/openai-oauth-callback.js +186 -0
  15. package/dist/openai-oauth-tokens.js +65 -0
  16. package/dist/openai-oauth.js +203 -0
  17. package/dist/provider-commands.js +79 -38
  18. package/dist/provider-label.js +10 -0
  19. package/dist/providers/anthropic-stream.js +8 -2
  20. package/dist/providers/anthropic.js +22 -6
  21. package/dist/providers/index.js +2 -1
  22. package/dist/providers/ollama-stream.js +3 -0
  23. package/dist/providers/ollama.js +4 -1
  24. package/dist/providers/openai-codex.js +157 -0
  25. package/dist/providers/openai-stream.js +13 -9
  26. package/dist/providers/openai-wire.js +4 -9
  27. package/dist/providers/openai.js +36 -15
  28. package/dist/providers/sse.js +1 -1
  29. package/dist/settings-command.js +64 -9
  30. package/dist/settings.js +2 -1
  31. package/dist/tools/args.js +4 -3
  32. package/dist/tools/fs.js +8 -3
  33. package/dist/tools/index.js +2 -2
  34. package/dist/tools/shell.js +2 -0
  35. package/dist/tui/app-workflows.js +5 -0
  36. package/dist/tui/components/messages.js +26 -5
  37. package/dist/tui/feedback.js +10 -6
  38. package/dist/tui/session-view.js +10 -4
  39. package/dist/tui/turn.js +4 -1
  40. package/dist/version.js +14 -0
  41. package/docs/assets/brand/jeco-256.png +0 -0
  42. package/package.json +5 -1
@@ -1,4 +1,5 @@
1
1
  // Operational feedback belongs in the footer, not in the conversation.
2
+ import { providerLabel } from "../provider-label.js";
2
3
  const INFO_MS = 2_200;
3
4
  const WARN_MS = 4_200;
4
5
  const ERROR_MS = 6_000;
@@ -50,23 +51,26 @@ export function commandFeedback(block) {
50
51
  /** Explain why a model turn cannot start, without exposing configuration internals. */
51
52
  export function turnBlocker(session) {
52
53
  const blocked = session.provider.blocked();
53
- if (blocked !== undefined && !blocked.startsWith(`${session.provider.keyVar} `)) {
54
+ const auth = session.provider.auth;
55
+ const expected = auth.kind === "api-key"
56
+ ? blocked?.startsWith(`${auth.keyVar} `) === true
57
+ : blocked !== undefined;
58
+ if (blocked !== undefined && !expected) {
54
59
  return { text: blocked, tone: "error" };
55
60
  }
56
61
  if (blocked !== undefined) {
57
62
  return {
58
- text: `${providerName(session.provider.id)} needs an API key · /settings`,
63
+ text: auth.kind === "oauth"
64
+ ? `${providerLabel(session.provider.id)} needs ${auth.label} sign-in · /settings`
65
+ : `${providerLabel(session.provider.id)} needs an API key · /settings`,
59
66
  tone: "warn",
60
67
  };
61
68
  }
62
69
  if (session.model === "") {
63
70
  return {
64
- text: `${providerName(session.provider.id)} needs a model · /models`,
71
+ text: `${providerLabel(session.provider.id)} needs a model · /models`,
65
72
  tone: "warn",
66
73
  };
67
74
  }
68
75
  return undefined;
69
76
  }
70
- function providerName(id) {
71
- return id === "" ? "Provider" : `${id[0]?.toUpperCase() ?? ""}${id.slice(1)}`;
72
- }
@@ -26,10 +26,16 @@ export function turnFailure(session, error, aborted) {
26
26
  return { kind: "notice", text: "[interrupted]", tone: "warn" };
27
27
  let text = providerFailure(session.provider, error);
28
28
  if (/\b401\b/.test(text)) {
29
- const source = credentialSource(session.provider.keyVar);
30
- text += source === "environment"
31
- ? ` · update ${session.provider.keyVar} in the environment and restart`
32
- : " · check credentials with /settings";
29
+ const auth = session.provider.auth;
30
+ if (auth.kind === "oauth") {
31
+ text += ` · reconnect ${auth.label} in /settings`;
32
+ }
33
+ else {
34
+ const source = credentialSource(auth.keyVar);
35
+ text += source === "environment"
36
+ ? ` · update ${auth.keyVar} in the environment and restart`
37
+ : " · check credentials with /settings";
38
+ }
33
39
  }
34
40
  return { kind: "notice", text, tone: "error" };
35
41
  }
package/dist/tui/turn.js CHANGED
@@ -110,7 +110,10 @@ export function transcribe(stage) {
110
110
  const block = tools.get(call.id);
111
111
  if (block === undefined || block.kind !== "tool")
112
112
  return;
113
- if (block.tone === "deny") {
113
+ // Explicit refusal stays a refusal. Cancellation can first settle an
114
+ // approval overlay as `no`, though, so its synthesized result must be
115
+ // allowed to reconcile that rail with the interrupted history.
116
+ if (block.tone === "deny" && summary !== "interrupted") {
114
117
  stage.render(block);
115
118
  return;
116
119
  }
@@ -0,0 +1,14 @@
1
+ // The package version is runtime identity, not configuration.
2
+ import { readFileSync } from "node:fs";
3
+ import * as path from "node:path";
4
+ let cached;
5
+ export function applicationVersion() {
6
+ if (cached !== undefined)
7
+ return cached;
8
+ const manifest = JSON.parse(readFileSync(path.resolve(import.meta.dirname, "..", "package.json"), "utf8"));
9
+ if (typeof manifest.version !== "string" || manifest.version === "") {
10
+ throw new Error("package version is missing");
11
+ }
12
+ cached = manifest.version;
13
+ return cached;
14
+ }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giovannijecha/jecode",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "An owned coding agent with zero external runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,12 +16,16 @@
16
16
  "terminal",
17
17
  "tui",
18
18
  "ollama",
19
+ "openai",
20
+ "chatgpt",
21
+ "oauth",
19
22
  "typescript"
20
23
  ],
21
24
  "type": "module",
22
25
  "files": [
23
26
  "bin/",
24
27
  "dist/",
28
+ "docs/assets/brand/jeco-256.png",
25
29
  "LICENSE",
26
30
  "README.md"
27
31
  ],