83 lines
4.4 KiB
JavaScript
83 lines
4.4 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.GitZoneOpenCodeContribution = exports.GitZoneOpenCodeNewSessionCommand = exports.GitZoneOpenCodeHealthCommand = void 0;
|
|
const common_menus_js_1 = require("@theia/core/lib/browser/common-menus.js");
|
|
const ws_connection_provider_js_1 = require("@theia/core/lib/browser/messaging/ws-connection-provider.js");
|
|
const command_js_1 = require("@theia/core/lib/common/command.js");
|
|
const menu_model_registry_js_1 = require("@theia/core/lib/common/menu/menu-model-registry.js");
|
|
const message_service_js_1 = require("@theia/core/lib/common/message-service.js");
|
|
const index_js_1 = require("@theia/core/shared/inversify/index.js");
|
|
const gitzone_opencode_protocol_js_1 = require("../common/gitzone-opencode-protocol.js");
|
|
exports.GitZoneOpenCodeHealthCommand = {
|
|
id: 'gitzone.opencode.health',
|
|
label: 'OpenCode: Check Health',
|
|
};
|
|
exports.GitZoneOpenCodeNewSessionCommand = {
|
|
id: 'gitzone.opencode.newSession',
|
|
label: 'OpenCode: New Session',
|
|
};
|
|
let GitZoneOpenCodeContribution = class GitZoneOpenCodeContribution {
|
|
openCodeServer;
|
|
messages;
|
|
registerCommands(registry) {
|
|
registry.registerCommand(exports.GitZoneOpenCodeHealthCommand, {
|
|
execute: async () => {
|
|
const health = await this.openCodeServer.health();
|
|
await this.messages.info(`OpenCode health: ${JSON.stringify(health)}`);
|
|
},
|
|
});
|
|
registry.registerCommand(exports.GitZoneOpenCodeNewSessionCommand, {
|
|
execute: async () => {
|
|
const session = await this.openCodeServer.createSession('Git.Zone IDE Session');
|
|
await this.messages.info(`OpenCode session created: ${JSON.stringify(session)}`);
|
|
},
|
|
});
|
|
}
|
|
registerMenus(menus) {
|
|
menus.registerMenuAction(common_menus_js_1.CommonMenus.VIEW_VIEWS, {
|
|
commandId: exports.GitZoneOpenCodeHealthCommand.id,
|
|
label: exports.GitZoneOpenCodeHealthCommand.label,
|
|
});
|
|
menus.registerMenuAction(common_menus_js_1.CommonMenus.VIEW_VIEWS, {
|
|
commandId: exports.GitZoneOpenCodeNewSessionCommand.id,
|
|
label: exports.GitZoneOpenCodeNewSessionCommand.label,
|
|
});
|
|
}
|
|
};
|
|
exports.GitZoneOpenCodeContribution = GitZoneOpenCodeContribution;
|
|
__decorate([
|
|
(0, index_js_1.inject)(gitzone_opencode_protocol_js_1.GitZoneOpenCodeServer),
|
|
__metadata("design:type", Object)
|
|
], GitZoneOpenCodeContribution.prototype, "openCodeServer", void 0);
|
|
__decorate([
|
|
(0, index_js_1.inject)(message_service_js_1.MessageService),
|
|
__metadata("design:type", message_service_js_1.MessageService)
|
|
], GitZoneOpenCodeContribution.prototype, "messages", void 0);
|
|
exports.GitZoneOpenCodeContribution = GitZoneOpenCodeContribution = __decorate([
|
|
(0, index_js_1.injectable)()
|
|
], GitZoneOpenCodeContribution);
|
|
const openCodeClient = {
|
|
onOpenCodeEvent: (event) => {
|
|
globalThis.dispatchEvent(new CustomEvent('gitzone-opencode-event', { detail: event }));
|
|
},
|
|
};
|
|
exports.default = new index_js_1.ContainerModule((bind) => {
|
|
bind(gitzone_opencode_protocol_js_1.GitZoneOpenCodeServer)
|
|
.toDynamicValue((context) => context.container
|
|
.get(ws_connection_provider_js_1.WebSocketConnectionProvider)
|
|
.createProxy(gitzone_opencode_protocol_js_1.gitZoneOpenCodePath, openCodeClient))
|
|
.inSingletonScope();
|
|
bind(GitZoneOpenCodeContribution).toSelf().inSingletonScope();
|
|
bind(command_js_1.CommandContribution).toService(GitZoneOpenCodeContribution);
|
|
bind(menu_model_registry_js_1.MenuContribution).toService(GitZoneOpenCodeContribution);
|
|
});
|
|
//# sourceMappingURL=gitzone-opencode-frontend-module.js.map
|